Documentation ¶
Index ¶
- Constants
- func MigrateMySQLTable(connection *sql.DB) []error
- type Account
- type MySQL
- func (a *MySQL) Create() error
- func (a MySQL) GetCreatedOn() time.Time
- func (a MySQL) GetDatabaseID() uint64
- func (a MySQL) GetEmail() string
- func (a MySQL) GetHashedPassword() string
- func (a MySQL) GetLastUpdated() time.Time
- func (a MySQL) GetUUID() string
- func (a MySQL) GetUsername() string
- func (a MySQL) JSON() []byte
- func (a *MySQL) LoadEmail(email string) error
- func (a *MySQL) LoadUUID(uuid string) error
- func (a *MySQL) LoadUsername(username string) error
- func (a *MySQL) SetEmail(email string) error
- func (a *MySQL) SetPassword(plaintext string) error
- func (a *MySQL) SetUsername(username string) error
- func (a *MySQL) Update() error
Constants ¶
const TableName = "account"
TableName defines the data store table name to use when storing information of the Account abstraction
Variables ¶
This section is empty.
Functions ¶
func MigrateMySQLTable ¶
Types ¶
type Account ¶
type Account interface { GetDatabaseID() uint64 GetUUID() string GetUsername() string GetEmail() string GetHashedPassword() string GetLastUpdated() time.Time GetCreatedOn() time.Time SetPassword(string) error SetUsername(string) error SetEmail(string) error Create() error LoadEmail(string) error LoadUsername(string) error LoadUUID(string) error Update() error JSON() []byte }
Account defines a user's primary account
func NewMySQLAccount ¶
NewMySQLAccount creates a new Account interface
type MySQL ¶
type MySQL struct { ID uint64 `json:"id"` UUID string `json:"uuid"` Email string `json:"email"` Username string `json:"username"` Password string `json:"password"` CreatedOn time.Time `json:"created_on"` LastUpdated time.Time `json:"last_updated"` // contains filtered or unexported fields }
MySQL defines an implementation for the Account interface that includes methods to interact with a MySQL data store
func (*MySQL) Create ¶
Create inserts the account into the data store and populates this instance with the generated ID and UUID
func (MySQL) GetCreatedOn ¶
GetCreatedOn complies to the Account interface
func (MySQL) GetDatabaseID ¶
GetDatabaseID complies to the Account interface
func (MySQL) GetHashedPassword ¶
GetHashedPassword complies to the Account interface
func (MySQL) GetLastUpdated ¶
GetLastUpdated complies to the Account interface
func (MySQL) GetUsername ¶
GetUsername complies to the Account interface
func (*MySQL) LoadUsername ¶
LoadUsername loads the user based on the provided username :username
func (*MySQL) SetEmail ¶
SetEmail sets the Email property of the account instance and is needed to comply to the Account interface
func (*MySQL) SetPassword ¶
SetPassword sets the Password property to a string that contains a hash and it's corresponding salt, and is required to comply with the Account interface
func (*MySQL) SetUsername ¶
SetUsername sets the Username property of the account instance and is needed to comply to the Account interface