Documentation ¶
Index ¶
- func Check(token string) (valid bool, member *model.Member, expiration time.Time)
- func CheckRoot()
- func Delete(a interface{})
- func Find(a interface{}) (exists bool)
- func FindAll(a interface{})
- func FindAllWhereEqual(a interface{}, field string, value interface{})
- func FindEventsRange(events *[]*model.Event, from time.Time, to time.Time)
- func Login(data *JWTData) (bool, string)
- func PasswordHash(plainPassword string) string
- func Register()
- func Save(a interface{})
- func TableCreate(a interface{})
- func UpdateCredentials(credentials *Credentials)
- type Credentials
- type DBError
- type JWTData
- type JWTHeader
- type JWTPayload
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Checks, if the given JWT is valid. Returns true if it is valid. Returns the member which belongs to the JWT. If the JWT is not valid, the member will be nil.
func CheckRoot ¶
func CheckRoot()
Checks if root user and role exists. If not, it creates both, the password will be printed on configured log tool.
func Find ¶
func Find(a interface{}) (exists bool)
Finds a single struct with an Id. Returns false if no struct exists with the given Id.
func FindAllWhereEqual ¶
func FindAllWhereEqual(a interface{}, field string, value interface{})
Finds a slice of structs with given condition.
func FindEventsRange ¶
Finds all events in the given time range 'from' and 'to' do only check the date but not the time events which's date are equal 'from' or 'to' will be included
func Login ¶
Does the login process. Returns true, if the login was successful. Returns the JWT for future request which require certain roles or permissions.
func PasswordHash ¶
Hashes a plaintext password and returns the hash.
func TableCreate ¶
func TableCreate(a interface{})
Creates tables for all registered structs, if not exist.
func UpdateCredentials ¶
func UpdateCredentials(credentials *Credentials)
Persists the given credentials to the equivalent member into the
Types ¶
type Credentials ¶
type Credentials struct { MemberId int64 `json:"memberId"` Username string `json:"username"` Password string `json:"password"` }
Defines the credentials with plain password.
type DBError ¶
type DBError struct {
// contains filtered or unexported fields
}
Generic error for all database related actions.
type JWTPayload ¶
Defines the JWT payload which is used to communicate between server and client.