accounts

package module
v0.0.0-...-22c6e00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2020 License: Apache-2.0 Imports: 9 Imported by: 1

README

Neuron Account

This repository contains Neuron auth.Account implementation.

Documentation

Index

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

func (a *Account) BeforeInsert(context.Context, database.DB) error

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

func (a *Account) GetPasswordHash() []byte

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

func (a *Account) GetPrimaryKeyStringValue() (string, error)

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) GetSalt

func (a *Account) GetSalt() []byte

GetSalt implements auth.SaltGetter interface.

func (*Account) GetUsername

func (a *Account) GetUsername() string

GetUsername implements auth.Account.

func (*Account) IsFieldZero

func (a *Account) IsFieldZero(field *mapping.StructField) (bool, error)

IsFieldZero implements mapping.Fielder interface.

func (*Account) IsPrimaryKeyZero

func (a *Account) IsPrimaryKeyZero() bool

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

func (a *Account) PasswordHashField() string

PasswordHashField implements auth.Account.

func (*Account) SaltField

func (a *Account) SaltField() string

SaltField implements auth.SaltFielder interface.

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) SetFrom

func (a *Account) SetFrom(model mapping.Model) error

SetFrom implements FromSetter interface.

func (*Account) SetPasswordHash

func (a *Account) SetPasswordHash(hash []byte)

SetPasswordHash implements auth.Account.

func (*Account) SetPrimaryKeyStringValue

func (a *Account) SetPrimaryKeyStringValue(value string) error

SetPrimaryKeyStringValue implements mapping.Model interface method.

func (*Account) SetPrimaryKeyValue

func (a *Account) SetPrimaryKeyValue(value interface{}) error

SetPrimaryKey implements mapping.Model interface method.

func (*Account) SetSalt

func (a *Account) SetSalt(salt []byte)

SetSalt implements auth.SaltSetter interface.

func (*Account) SetUsername

func (a *Account) SetUsername(username string)

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

func (a *Account) UsernameField() string

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

func (*NRN_Accounts) Update

func (_a *NRN_Accounts) Update(ctx context.Context, db database.DB, models ...*accounts.Account) (int64, error)

Update updates accounts.Account models into database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL