Documentation ¶
Index ¶
- Constants
- func GetAuthorizationBearerToken(r *http.Request) string
- func GetUserIDFromRequest(r *http.Request) int64
- type ErrUmbrella
- type GoCRUDSession
- func (g *GoCRUDSession) CreateDBTable() error
- func (g *GoCRUDSession) GetByKey(key string) (bool, error)
- func (g *GoCRUDSession) GetExpiresAt() int64
- func (g *GoCRUDSession) GetFlags() int
- func (g *GoCRUDSession) GetKey() string
- func (g *GoCRUDSession) GetUserID() int
- func (g *GoCRUDSession) Save() error
- func (g *GoCRUDSession) SetExpiresAt(exp int64)
- func (g *GoCRUDSession) SetFlags(flags int)
- func (g *GoCRUDSession) SetKey(k string)
- func (g *GoCRUDSession) SetUserID(i int)
- type GoCRUDUser
- func (g *GoCRUDUser) CreateDBTable() error
- func (g *GoCRUDUser) GetByEmail(email string) (bool, error)
- func (g *GoCRUDUser) GetByEmailActivationKey(key string) (bool, error)
- func (g *GoCRUDUser) GetByID(id int) (bool, error)
- func (g *GoCRUDUser) GetEmail() string
- func (g *GoCRUDUser) GetEmailActivationKey() string
- func (g *GoCRUDUser) GetExtraField(n string) string
- func (g *GoCRUDUser) GetFlags() int
- func (g *GoCRUDUser) GetID() int
- func (g *GoCRUDUser) GetPassword() string
- func (g *GoCRUDUser) Save() error
- func (g *GoCRUDUser) SetEmail(e string)
- func (g *GoCRUDUser) SetEmailActivationKey(k string)
- func (g *GoCRUDUser) SetExtraField(n string, v string)
- func (g *GoCRUDUser) SetFlags(flags int)
- func (g *GoCRUDUser) SetPassword(p string)
- 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 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 GoCRUDSession ¶
type GoCRUDSession struct {
// contains filtered or unexported fields
}
GoCRUDSession is default implementation of SessionInterface using go-crud
func (*GoCRUDSession) CreateDBTable ¶
func (g *GoCRUDSession) CreateDBTable() error
func (*GoCRUDSession) GetExpiresAt ¶
func (g *GoCRUDSession) GetExpiresAt() int64
func (*GoCRUDSession) GetFlags ¶
func (g *GoCRUDSession) GetFlags() int
func (*GoCRUDSession) GetKey ¶
func (g *GoCRUDSession) GetKey() string
func (*GoCRUDSession) GetUserID ¶
func (g *GoCRUDSession) GetUserID() int
func (*GoCRUDSession) Save ¶
func (g *GoCRUDSession) Save() error
func (*GoCRUDSession) SetExpiresAt ¶
func (g *GoCRUDSession) SetExpiresAt(exp int64)
func (*GoCRUDSession) SetFlags ¶
func (g *GoCRUDSession) SetFlags(flags int)
func (*GoCRUDSession) SetKey ¶
func (g *GoCRUDSession) SetKey(k string)
func (*GoCRUDSession) SetUserID ¶
func (g *GoCRUDSession) SetUserID(i int)
type GoCRUDUser ¶
type GoCRUDUser struct {
// contains filtered or unexported fields
}
GoCRUDUser is default implementation of UserInterface using go-crud
func (*GoCRUDUser) CreateDBTable ¶
func (g *GoCRUDUser) CreateDBTable() error
func (*GoCRUDUser) GetByEmail ¶
func (g *GoCRUDUser) GetByEmail(email string) (bool, error)
func (*GoCRUDUser) GetByEmailActivationKey ¶
func (g *GoCRUDUser) GetByEmailActivationKey(key string) (bool, error)
func (*GoCRUDUser) GetEmail ¶
func (g *GoCRUDUser) GetEmail() string
func (*GoCRUDUser) GetEmailActivationKey ¶
func (g *GoCRUDUser) GetEmailActivationKey() string
func (*GoCRUDUser) GetExtraField ¶
func (g *GoCRUDUser) GetExtraField(n string) string
func (*GoCRUDUser) GetFlags ¶
func (g *GoCRUDUser) GetFlags() int
func (*GoCRUDUser) GetID ¶
func (g *GoCRUDUser) GetID() int
func (*GoCRUDUser) GetPassword ¶
func (g *GoCRUDUser) GetPassword() string
func (*GoCRUDUser) Save ¶
func (g *GoCRUDUser) Save() error
func (*GoCRUDUser) SetEmail ¶
func (g *GoCRUDUser) SetEmail(e string)
func (*GoCRUDUser) SetEmailActivationKey ¶
func (g *GoCRUDUser) SetEmailActivationKey(k string)
func (*GoCRUDUser) SetExtraField ¶
func (g *GoCRUDUser) SetExtraField(n string, v string)
func (*GoCRUDUser) SetFlags ¶
func (g *GoCRUDUser) SetFlags(flags int)
func (*GoCRUDUser) SetPassword ¶
func (g *GoCRUDUser) SetPassword(p string)
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" crud:"lenmin:0 lenmax:50"` Email string `json:"email" crud:"req"` Password string `json:"password"` EmailActivationKey string `json:"email_activation_key" crud:""` CreatedAt int `json:"created_at"` CreatedByUserID int `json:"created_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.