Documentation
¶
Index ¶
- type Account
- func (a *Account) BeforeInsert(context.Context, database.DB) error
- func (a *Account) GetFieldValue(field *mapping.StructField) (interface{}, error)
- func (a *Account) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)
- func (a *Account) GetFieldsAddress(field *mapping.StructField) (interface{}, error)
- func (a *Account) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)
- func (a *Account) GetPasswordHash() []byte
- func (a *Account) GetPrimaryKeyAddress() interface{}
- func (a *Account) GetPrimaryKeyHashableValue() interface{}
- func (a *Account) GetPrimaryKeyStringValue() (string, error)
- func (a *Account) GetPrimaryKeyValue() interface{}
- func (a *Account) GetPrimaryKeyZeroValue() interface{}
- func (a *Account) GetSalt() []byte
- func (a *Account) GetUsername() string
- func (a *Account) IsFieldZero(field *mapping.StructField) (bool, error)
- func (a *Account) IsPrimaryKeyZero() bool
- func (a *Account) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)
- func (a *Account) PasswordHashField() string
- func (a *Account) SaltField() string
- func (a *Account) SetFieldValue(field *mapping.StructField, value interface{}) (err error)
- func (a *Account) SetFieldZeroValue(field *mapping.StructField) error
- func (a *Account) SetFrom(model mapping.Model) error
- func (a *Account) SetPasswordHash(hash []byte)
- func (a *Account) SetPrimaryKeyStringValue(value string) error
- func (a *Account) SetPrimaryKeyValue(value interface{}) error
- func (a *Account) SetSalt(salt []byte)
- func (a *Account) SetUsername(username string)
- func (a *Account) StructFieldValue(field *mapping.StructField) (interface{}, error)
- func (a *Account) UsernameField() string
- type NRN_Accounts
- func (_a *NRN_Accounts) Delete(ctx context.Context, db database.DB, models ...*accounts.Account) (int64, error)
- func (_a *NRN_Accounts) FromModels(input ...mapping.Model) []*accounts.Account
- func (_a *NRN_Accounts) Insert(ctx context.Context, db database.DB, models ...*accounts.Account) error
- func (_a *NRN_Accounts) ModelStruct() *mapping.ModelStruct
- func (_a *NRN_Accounts) Query(db database.DB, models ...*accounts.Account) *_accountsQueryBuilder
- func (_a *NRN_Accounts) QueryCtx(ctx context.Context, db database.DB, models ...*accounts.Account) *_accountsQueryBuilder
- func (_a *NRN_Accounts) Refresh(ctx context.Context, db database.DB, models ...*accounts.Account) error
- func (_a *NRN_Accounts) ToModels(input ...*accounts.Account) []mapping.Model
- func (_a *NRN_Accounts) Update(ctx context.Context, db database.DB, models ...*accounts.Account) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID uuid.UUID // Timestamps for the account. CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time `codec:";omitempty"` // Username is the unique account username. Username string `db:";unique"` // PasswordHash is the hash obtained by hashing the password. // Both of these fields has a json tag so that the token wouldn't keep password hash and password salt. PasswordHash []byte `codec:"-" json:"-"` PasswordSalt []byte `codec:"-" json:"-"` }
Account is the basic model used for authentication and authorization.
func (*Account) BeforeInsert ¶
BeforeInsert is a hook before insertion of the account.
func (*Account) GetFieldValue ¶
func (a *Account) GetFieldValue(field *mapping.StructField) (interface{}, error)
GetFieldValue implements mapping.Fielder interface.
func (*Account) GetFieldZeroValue ¶
func (a *Account) GetFieldZeroValue(field *mapping.StructField) (interface{}, error)
GetFieldZeroValue implements mapping.Fielder interface.s
func (*Account) GetFieldsAddress ¶
func (a *Account) GetFieldsAddress(field *mapping.StructField) (interface{}, error)
GetFieldsAddress gets the address of provided 'field'.
func (*Account) GetHashableFieldValue ¶
func (a *Account) GetHashableFieldValue(field *mapping.StructField) (interface{}, error)
GetHashableFieldValue implements mapping.Fielder interface.
func (*Account) GetPasswordHash ¶
GetPasswordHash implements auth.Account.
func (*Account) GetPrimaryKeyAddress ¶
func (a *Account) GetPrimaryKeyAddress() interface{}
GetPrimaryKeyAddress implements mapping.Model interface method.
func (*Account) GetPrimaryKeyHashableValue ¶
func (a *Account) GetPrimaryKeyHashableValue() interface{}
GetPrimaryKeyHashableValue implements mapping.Model interface method.
func (*Account) GetPrimaryKeyStringValue ¶
GetPrimaryKeyStringValue implements mapping.Model interface method.
func (*Account) GetPrimaryKeyValue ¶
func (a *Account) GetPrimaryKeyValue() interface{}
GetPrimaryKeyValue implements mapping.Model interface method.
func (*Account) GetPrimaryKeyZeroValue ¶
func (a *Account) GetPrimaryKeyZeroValue() interface{}
GetPrimaryKeyZeroValue implements mapping.Model interface method.
func (*Account) GetUsername ¶
GetUsername implements auth.Account.
func (*Account) IsFieldZero ¶
func (a *Account) IsFieldZero(field *mapping.StructField) (bool, error)
IsFieldZero implements mapping.Fielder interface.
func (*Account) IsPrimaryKeyZero ¶
IsPrimaryKeyZero implements mapping.Model interface method.
func (*Account) ParseFieldsStringValue ¶
func (a *Account) ParseFieldsStringValue(field *mapping.StructField, value string) (interface{}, error)
SetPrimaryKeyStringValue implements mapping.Model interface method.
func (*Account) PasswordHashField ¶
PasswordHashField implements auth.Account.
func (*Account) SetFieldValue ¶
func (a *Account) SetFieldValue(field *mapping.StructField, value interface{}) (err error)
SetFieldValue implements mapping.Fielder interface.
func (*Account) SetFieldZeroValue ¶
func (a *Account) SetFieldZeroValue(field *mapping.StructField) error
SetFieldZeroValue implements mapping.Fielder interface.s
func (*Account) SetPasswordHash ¶
SetPasswordHash implements auth.Account.
func (*Account) SetPrimaryKeyStringValue ¶
SetPrimaryKeyStringValue implements mapping.Model interface method.
func (*Account) SetPrimaryKeyValue ¶
SetPrimaryKey implements mapping.Model interface method.
func (*Account) SetUsername ¶
SetUsername implements auth.Account.
func (*Account) StructFieldValue ¶
func (a *Account) StructFieldValue(field *mapping.StructField) (interface{}, error)
StructFieldValues gets the value for specified 'field'.
func (*Account) UsernameField ¶
UsernameField implements auth.Account.
type NRN_Accounts ¶
type NRN_Accounts struct {
// contains filtered or unexported fields
}
NRN_Accounts is the query helper that provides model specific database API.
func (*NRN_Accounts) Delete ¶
func (_a *NRN_Accounts) Delete(ctx context.Context, db database.DB, models ...*accounts.Account) (int64, error)
Delete deletes accounts.Account models in database.
func (*NRN_Accounts) FromModels ¶
func (_a *NRN_Accounts) FromModels(input ...mapping.Model) []*accounts.Account
FromModels converts the input mapping.Model into []*accounts.Account.
func (*NRN_Accounts) Insert ¶
func (_a *NRN_Accounts) Insert(ctx context.Context, db database.DB, models ...*accounts.Account) error
Insert inserts accounts.Account into database.
func (*NRN_Accounts) ModelStruct ¶
func (_a *NRN_Accounts) ModelStruct() *mapping.ModelStruct
ModelStruct gets the stored model struct.
func (*NRN_Accounts) Query ¶
func (_a *NRN_Accounts) Query(db database.DB, models ...*accounts.Account) *_accountsQueryBuilder
Query creates the query for the accounts.Account.
func (*NRN_Accounts) QueryCtx ¶
func (_a *NRN_Accounts) QueryCtx(ctx context.Context, db database.DB, models ...*accounts.Account) *_accountsQueryBuilder
QueryCtx creates the query for the accounts.Account with provided 'ctx' context.
func (*NRN_Accounts) Refresh ¶
func (_a *NRN_Accounts) Refresh(ctx context.Context, db database.DB, models ...*accounts.Account) error
Refresh creates the query for the accounts.Account with provided 'ctx' context.
func (*NRN_Accounts) ToModels ¶
func (_a *NRN_Accounts) ToModels(input ...*accounts.Account) []mapping.Model
ToModels converts the input slice of accounts.Account into []mapping.Model