Documentation
¶
Index ¶
- Constants
- func GetAuthorizationBearerToken(r *http.Request) string
- func GetUserIDFromRequest(r *http.Request) int64
- type DefaultSession
- func (g *DefaultSession) CreateDBTable() error
- func (g *DefaultSession) GetByKey(key string) (bool, error)
- func (g *DefaultSession) GetExpiresAt() int64
- func (g *DefaultSession) GetFlags() int
- func (g *DefaultSession) GetKey() string
- func (g *DefaultSession) GetUserID() int
- func (g *DefaultSession) Save() error
- func (g *DefaultSession) SetExpiresAt(exp int64)
- func (g *DefaultSession) SetFlags(flags int)
- func (g *DefaultSession) SetKey(k string)
- func (g *DefaultSession) SetUserID(i int)
- type DefaultUser
- func (g *DefaultUser) CreateDBTable() error
- func (g *DefaultUser) GetByEmail(email string) (bool, error)
- func (g *DefaultUser) GetByEmailActivationKey(key string) (bool, error)
- func (g *DefaultUser) GetByID(id int) (bool, error)
- func (g *DefaultUser) GetEmail() string
- func (g *DefaultUser) GetEmailActivationKey() string
- func (g *DefaultUser) GetExtraField(n string) string
- func (g *DefaultUser) GetFlags() int
- func (g *DefaultUser) GetID() int
- func (g *DefaultUser) GetPassword() string
- func (g *DefaultUser) Save() error
- func (g *DefaultUser) SetEmail(e string)
- func (g *DefaultUser) SetEmailActivationKey(k string)
- func (g *DefaultUser) SetExtraField(n string, v string)
- func (g *DefaultUser) SetFlags(flags int)
- func (g *DefaultUser) SetPassword(p string)
- type ErrUmbrella
- type HTTPResponse
- type Hooks
- type Interfaces
- type JWTConfig
- type Session
- type SessionInterface
- type Umbrella
- type User
- type UserExtraField
- type UserInterface
Constants ¶
View Source
const DisableCheck = 8
View Source
const DisableConfirm = 2
View Source
const DisableLogin = 4
View Source
const DisableRegister = 1
View Source
const FlagSessionActive = 1
View Source
const FlagSessionLoggedOut = 2
View Source
const FlagUserActive = 1
View Source
const FlagUserAllowLogin = 4
View Source
const FlagUserEmailConfirmed = 2
View Source
const RegisterAllowedToLogin = 32
View Source
const RegisterConfirmed = 16
Variables ¶
This section is empty.
Functions ¶
func GetUserIDFromRequest ¶
Types ¶
type DefaultSession ¶
type DefaultSession struct {
// contains filtered or unexported fields
}
DefaultSession is default implementation of SessionInterface using struct-db-postgres
func (*DefaultSession) CreateDBTable ¶
func (g *DefaultSession) CreateDBTable() error
func (*DefaultSession) GetExpiresAt ¶
func (g *DefaultSession) GetExpiresAt() int64
func (*DefaultSession) GetFlags ¶
func (g *DefaultSession) GetFlags() int
func (*DefaultSession) GetKey ¶
func (g *DefaultSession) GetKey() string
func (*DefaultSession) GetUserID ¶
func (g *DefaultSession) GetUserID() int
func (*DefaultSession) Save ¶
func (g *DefaultSession) Save() error
func (*DefaultSession) SetExpiresAt ¶
func (g *DefaultSession) SetExpiresAt(exp int64)
func (*DefaultSession) SetFlags ¶
func (g *DefaultSession) SetFlags(flags int)
func (*DefaultSession) SetKey ¶
func (g *DefaultSession) SetKey(k string)
func (*DefaultSession) SetUserID ¶
func (g *DefaultSession) SetUserID(i int)
type DefaultUser ¶
type DefaultUser struct {
// contains filtered or unexported fields
}
DefaultUserModel is default implementation of UserInterface using struct-db-postgres package
func (*DefaultUser) CreateDBTable ¶
func (g *DefaultUser) CreateDBTable() error
func (*DefaultUser) GetByEmail ¶
func (g *DefaultUser) GetByEmail(email string) (bool, error)
func (*DefaultUser) GetByEmailActivationKey ¶
func (g *DefaultUser) GetByEmailActivationKey(key string) (bool, error)
func (*DefaultUser) GetEmail ¶
func (g *DefaultUser) GetEmail() string
func (*DefaultUser) GetEmailActivationKey ¶
func (g *DefaultUser) GetEmailActivationKey() string
func (*DefaultUser) GetExtraField ¶
func (g *DefaultUser) GetExtraField(n string) string
func (*DefaultUser) GetFlags ¶
func (g *DefaultUser) GetFlags() int
func (*DefaultUser) GetID ¶
func (g *DefaultUser) GetID() int
func (*DefaultUser) GetPassword ¶
func (g *DefaultUser) GetPassword() string
func (*DefaultUser) Save ¶
func (g *DefaultUser) Save() error
func (*DefaultUser) SetEmail ¶
func (g *DefaultUser) SetEmail(e string)
func (*DefaultUser) SetEmailActivationKey ¶
func (g *DefaultUser) SetEmailActivationKey(k string)
func (*DefaultUser) SetExtraField ¶
func (g *DefaultUser) SetExtraField(n string, v string)
func (*DefaultUser) SetFlags ¶
func (g *DefaultUser) SetFlags(flags int)
func (*DefaultUser) SetPassword ¶
func (g *DefaultUser) SetPassword(p string)
type ErrUmbrella ¶
ErrUmbrella wraps original error that occurred in Err with name of the operation/step that failed, which is in Op field
func (*ErrUmbrella) Error ¶
func (e *ErrUmbrella) Error() string
func (*ErrUmbrella) Unwrap ¶
func (e *ErrUmbrella) Unwrap() error
type HTTPResponse ¶
type HTTPResponse struct { OK int8 `json:"ok"` ErrText string `json:"err_text"` Data map[string]interface{} `json:"data"` }
HTTPResponse is a base structure for all the HTTP responses from HTTP endpoints
func NewHTTPResponse ¶
func NewHTTPResponse(ok int8, errText string) HTTPResponse
NewHTTPResponse returns new HTTPResponse object
type Hooks ¶
type Hooks struct { PostRegisterSuccess func(http.ResponseWriter, string) bool PostConfirmSuccess func(http.ResponseWriter) bool PostLoginSuccess func(http.ResponseWriter, string, string, int64) bool PostCheckSuccess func(http.ResponseWriter, string, int64, bool) bool PostLogoutSuccess func(http.ResponseWriter, string) bool }
type Interfaces ¶
type Interfaces struct { User func() UserInterface Session func() SessionInterface }
type SessionInterface ¶
type Umbrella ¶
type Umbrella struct { Hooks *Hooks Interfaces *Interfaces Flags int UserExtraFields []UserExtraField // contains filtered or unexported fields }
func NewUmbrellaWithDB ¶
func (Umbrella) CreateDBTables ¶
func (u Umbrella) CreateDBTables() *ErrUmbrella
type User ¶
type User struct { ID int `json:"user_id"` Flags int `json:"flags"` Name string `json:"name" 2db:"lenmin:0 lenmax:50"` Email string `json:"email" 2db:"req"` Password string `json:"password"` EmailActivationKey string `json:"email_activation_key" 2db:""` CreatedAt int `json:"created_at"` CreatedByUserID int `json:"created_by_user_id"` LastModifiedAt int `json:"last_modified_at"` LastModifiedByUserID int `json:"last_modified_by_user_id"` }
type UserExtraField ¶
type UserInterface ¶
type UserInterface interface { CreateDBTable() error GetID() int GetEmail() string SetEmail(string) GetPassword() string SetPassword(string) GetEmailActivationKey() string SetEmailActivationKey(string) GetFlags() int SetFlags(int) GetExtraField(n string) string SetExtraField(n string, v string) Save() error GetByID(int) (bool, error) GetByEmail(string) (bool, error) GetByEmailActivationKey(string) (bool, error) }
Click to show internal directories.
Click to hide internal directories.