Domain Documentation

Class Users

public final class Users: Model  

Representation of Users table.

Users Users Model Model Users->Model

Conforms To

Model

Initializers

init()

public init()  

init(id:​username:​email:​bio:​image:​hash:​salt:​)

public init(id: Int?, username: String, email: String, bio: String = "", image: String = "", hash: String, salt: String)  

Default initializer.

Parameters

id Int?

See id.

username String

See username.

email String

See email.

bio String

See bio.

image String

See image.

hash String

See hash.

salt String

See salt.

Properties

schema

public static let schema = "Users"

id

@ID(custom: .id, generatedBy: .database)
    public var id: Int? 

A Identifier.

It is assumed that the value is entered on the Database side. The application does not change this value usually.

username

@Field(key: "username")
    public var username: String

A user name.

email

@Field(key: "email")
    public var email: String

A email.

bio

@Field(key: "bio")
    public var bio: String

A biography.

image

@Field(key: "image")
    public var image: String

A user icon image URL.

hash

@Field(key: "hash")
    public var hash: String

A hashed password.

salt

@Field(key: "salt")
    public var salt: String

A salt added when the password is hashed.

follows

@Children(for: \.$follower)
    public var follows: [Follows] 

Follows this user

articles

@Children(for: \.$author)
    public var articles: [Articles] 

Articles which this user writen.

Methods

create(on:​)

public static func create(on database: MySQLDatabase) -> EventLoopFuture<Void>  

Execute SQL statement for table creation.

In general, you should use features provided by the following standards: https://docs.vapor.codes/3.0/fluent/models/#create

Parameters

connection

A established connection.