Documentation
¶
Index ¶
- Constants
- Variables
- func ClearDB()
- func DeleteUser(userID uint) error
- func GetUserRoles(userId uint) ([]string, error)
- func HashAndSalt(password string, config *helpers.Config) (string, error)
- func InitDB(config *helpers.Config) (*sqlx.DB, error)
- type FeedBack
- type OAuthRegister
- type PublicUser
- type User
- type UserAccount
- type UserPicture
Constants ¶
View Source
const ( USER_ROLE = "USER" ADMIN_ROLE = "ADMIN" )
Variables ¶
View Source
var DefaultUserPicture = []byte{} /* 2116 elements not displayed */
Functions ¶
func DeleteUser ¶
func GetUserRoles ¶
GetUserRoles return user roles by user id
Types ¶
type OAuthRegister ¶
type OAuthRegister struct { ID string `db:"id" json:"id"` OAuthName string `db:"oauth_name" json:"oauth_name"` UserInServiceID string `db:"user_id" json:"-"` Nick string `db:"nick" json:"nick"` Name string `db:"name" json:"name"` Email string `db:"email" json:"email"` Picture string `db:"picture" json:"picture"` }
OAuthRegister oauth registration info
func GetOAuthRegister ¶
func GetOAuthRegister(registerID string) (OAuthRegister, error)
GetOAuthRegister return OAuthRegister by registration id
type PublicUser ¶
type PublicUser struct { ID uint `db:"id" json:"id"` Nick string `db:"nick" json:"nick"` Name string `db:"name" json:"name"` Roles []string `db:"roles" json:"roles"` }
PublicUser public user model. This model can see all users
type User ¶
type User struct { ID uint `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` Email string `db:"email" json:"email"` Nick string `db:"nick" json:"nick"` Name string `db:"name" json:"name"` PasswordHash string `db:"password_hash" json:"-"` RefreshToken string `db:"refresh_token" json:"-"` Roles []string `db:"roles" json:"roles"` }
User model. This model can see dev and user
func GetUserByNick ¶
GetUserByNick return user by user nick
func (User) ToPublic ¶
func (user User) ToPublic() PublicUser
type UserAccount ¶
type UserAccount struct { ID uint `db:"id" json:"-"` UserID uint `db:"user_id" json:"-"` Service string `db:"service" json:"service"` InServiceID string `db:"in_service_id" json:"in_service_id"` }
UserAccount oauth accounts connected to user
func GetUserAccount ¶
func GetUserAccount(userInServiceID string, oauthName string) (UserAccount, error)
GetUserAccount return UserAccount by userInServiceId and oauth service name
type UserPicture ¶
UserPicture user picture
Click to show internal directories.
Click to hide internal directories.