Documentation
¶
Index ¶
- func Hash(password string) ([]byte, error)
- func VerifyPassword(hashedPassword, password string) error
- type BaseModel
- type Profile
- type ResourceOperation
- func (r *ResourceOperation) FindByMethodAndPath(method, path string) (*ResourceOperation, error)
- func (r *ResourceOperation) Prepare()
- func (u *ResourceOperation) Save() (*ResourceOperation, error)
- func (r *ResourceOperation) Update(uid uint64) (*ResourceOperation, error)
- func (r *ResourceOperation) Upsert() (*ResourceOperation, error)
- type Role
- type User
- func (u *User) BeforeSave() error
- func (u *User) DeleteAUser(uid uint32) (int64, error)
- func (u *User) FindAllUsers() (*[]User, error)
- func (u *User) FindUserByID(uid uint32) (*User, error)
- func (u *User) Login() error
- func (u *User) Prepare()
- func (u *User) SaveUser() (*User, error)
- func (u *User) UpdateAUser(uid uint32) (*User, error)
- func (u *User) Validate(action string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyPassword ¶
Types ¶
type BaseModel ¶
type BaseModel struct { ID uint64 `gorm:"primary_key;auto_increment" json:"id"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time `sql:"index"` }
BaseModel is used by other models to have default columns
type ResourceOperation ¶
type ResourceOperation struct { BaseModel Path string `gorm:"size:1024;not null;index" json:"path"` HTTPMethod string `gorm:"size:10;not null;index" json:"http_method"` Role []*Role `gorm:"many2many:role_resourcesoperations;"` Description string `gorm:"size:2048;not null;index" json:"description"` }
func (*ResourceOperation) FindByMethodAndPath ¶
func (r *ResourceOperation) FindByMethodAndPath(method, path string) (*ResourceOperation, error)
func (*ResourceOperation) Prepare ¶
func (r *ResourceOperation) Prepare()
func (*ResourceOperation) Save ¶
func (u *ResourceOperation) Save() (*ResourceOperation, error)
func (*ResourceOperation) Update ¶
func (r *ResourceOperation) Update(uid uint64) (*ResourceOperation, error)
func (*ResourceOperation) Upsert ¶
func (r *ResourceOperation) Upsert() (*ResourceOperation, error)
type Role ¶
type Role struct { BaseModel Name string `gorm:"size:100;not null;unique" json:"name"` ResourceOperation []ResourceOperation `gorm:"many2many:role_resourcesoperations;"` }
type User ¶
type User struct { BaseModel Email string `gorm:"size:100;not null;unique" json:"email"` Mobile string `gorm:"size:13;unique" json:"mobile"` Password string `gorm:"size:100;not null;" json:"password"` Nickname string `gorm:"size:100" json:"nickname"` RoleID uint64 `gorm:"null" json:"role_id"` Role Role Profile *Profile }
func (*User) BeforeSave ¶
func (*User) FindAllUsers ¶
Click to show internal directories.
Click to hide internal directories.