Documentation ¶
Index ¶
- type Controller
- type Credentials
- type Input
- type Login
- type RepositoryUser
- func (m *RepositoryUser) Authenticate(username string, password string) (Users, string, bool, error)
- func (m *RepositoryUser) Create(newUser Input) (Users, bool, error)
- func (m *RepositoryUser) CreateAdmin() (map[string]string, bool, error)
- func (m *RepositoryUser) CreateToken(user Users) (string, error)
- func (m *RepositoryUser) Delete(uuid uuid.UUID)
- func (m *RepositoryUser) Get() (Users, error)
- func (m *RepositoryUser) GetBy(column, value string) (Users, error)
- func (m *RepositoryUser) GetByEmail(email string) (Users, error)
- func (m *RepositoryUser) GetByID(uuid uuid.UUID) (Users, error)
- func (m *RepositoryUser) GetByUsername(username string) (Users, error)
- type RepositoryUsers
- type Signin
- type Signup
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials struct { database.BaseModel UserID uuid.UUID `gorm:"index:user_id;column:user_id;type:uuid;not null"` Users Users `gorm:"association_foreignkey:user_id;foreignkey:id"` Type string `gorm:"column:type;type:varchar(20);not null"` // 'password','email','phone','sshkey','vendor','fingerprint' UserKey string `gorm:"column:user_key;type:text"` UserValue string `gorm:"column:user_value;type:text"` Status string `gorm:"column:status;type:varchar(20);not null"` // enum('active','inactive','unverified','deleted') LastAccessedAt time.Time `gorm:"column:last_accessed_at;type:datetime;not null"` Desc string `gorm:"column:desc;type:text"` }
Credentials [...]
type Input ¶
type Input struct { Username string `json:"username"` Name string `json:"name"` Email string `json:"email"` Password string `json:"password"` }
Input struct
type RepositoryUser ¶
RepositoryUser ...
func (*RepositoryUser) Authenticate ¶
func (m *RepositoryUser) Authenticate(username string, password string) (Users, string, bool, error)
Authenticate method
func (*RepositoryUser) Create ¶
func (m *RepositoryUser) Create(newUser Input) (Users, bool, error)
Create for a user
func (*RepositoryUser) CreateAdmin ¶
func (m *RepositoryUser) CreateAdmin() (map[string]string, bool, error)
CreateAdmin for the first time only
func (*RepositoryUser) CreateToken ¶
func (m *RepositoryUser) CreateToken(user Users) (string, error)
CreateToken ...
func (*RepositoryUser) GetBy ¶
func (m *RepositoryUser) GetBy(column, value string) (Users, error)
GetBy ...
func (*RepositoryUser) GetByEmail ¶
func (m *RepositoryUser) GetByEmail(email string) (Users, error)
GetByEmail ...
func (*RepositoryUser) GetByID ¶
func (m *RepositoryUser) GetByID(uuid uuid.UUID) (Users, error)
GetByID ...
func (*RepositoryUser) GetByUsername ¶
func (m *RepositoryUser) GetByUsername(username string) (Users, error)
GetByUsername ...
type RepositoryUsers ¶
type RepositoryUsers interface { Get() (user Users, err error) Authenticate(string, string) (Users, string, bool, error) CreateAdmin() (map[string]string, bool, error) CreateToken(user Users) (string, error) Create(newUser Input) (Users, bool, error) Delete(uuid uuid.UUID) }
RepositoryUsers ...
type Users ¶
type Users struct { database.BaseModel Username string `gorm:"unique;column:username;type:varchar(20);not null"` Name string `gorm:"column:name;type:varchar(30)"` Status string `gorm:"column:status;type:varchar(20);not null"` LastLogin time.Time `gorm:"column:last_login;type:datetime"` VerificationCode string `gorm:"unique;column:verification_code;type:varchar(8)"` ForgotPasswordCode string `gorm:"unique;column:forgot_password_code;type:varchar(8)"` ForgotPasswordCodeValidTime time.Time `gorm:"column:forgot_password_code_valid_time;type:datetime"` }
Users data of struct
Click to show internal directories.
Click to hide internal directories.