Documentation ¶
Index ¶
- type Apikey
- type Database
- func (self *Database) CreateUser(email, username string) (*User, error)
- func (self *Database) CreateUserIfNotExists(email, username string) (*User, error)
- func (self *Database) Exec(clbk func(*sql.DB) error) error
- func (self *Database) GetUserByEmail(email string) (*User, error)
- func (self *Database) GetUserByUsername(username string) (*User, error)
- func (self *Database) GetUsers() ([]*User, error)
- func (self *Database) GetVersion() (string, error)
- func (self *Database) Insert(query string, args ...interface{}) error
- func (self *Database) QueryRow(query string, args ...interface{}) *sql.Row
- func (self *Database) Select(model Model, query string, args ...interface{}) error
- type Filter
- type Model
- type User
- func (self *User) Activate() error
- func (self *User) CreateApikey(name string) (*Apikey, error)
- func (self *User) CreateSocialAccountIfNotExists(social_id, social_name, social_type string) error
- func (self *User) Deactivate() error
- func (self *User) Delete() error
- func (self *User) IsPassword(password string) (bool, error)
- func (self *User) SetDatabase(db *Database)
- func (self *User) SetEmail(email string) error
- func (self *User) SetPassword(password string) error
- func (self *User) Update() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Apikey ¶
type Apikey struct { UserId string `json:"user_id"` Name string `json:"name"` Apikey string `json:"apikey"` Secret string `json:"secret"` IsDeleted bool `json:"is_deleted"` IsActive bool `json:"is_active"` CreatedAt time.Time `json:"created_at,string"` UpdatedAt time.Time `json:"updated_at,string"` // contains filtered or unexported fields }
Apikey struct of apikey object
func (*Apikey) Deactivate ¶
Deactivate markers object as inactive
func (*Apikey) SetDatabase ¶
SetDatabase set object database reference
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database struct
func (*Database) CreateUser ¶
CreateUser creates new user
func (*Database) CreateUserIfNotExists ¶
CreateUserIfNotExists creates new user if does not exist
func (*Database) GetUserByEmail ¶
GetUserByEmail get user by email
func (*Database) GetUserByUsername ¶
GetUserByUsername get user by username
func (*Database) GetVersion ¶
GetVersion returns database version
type Filter ¶
type Filter struct { Logical string `json:"logical,omitempty"` Test string `json:"test,omitempty"` ColumnId string `json:"column_id,omitempty"` Value string `json:"value,omitempty"` Values []string `json:"values,omitempty"` Min float64 `json:"min,omitempty"` Max float64 `json:"max,omitempty"` Start time.Time `json:"start,omitempty"` End time.Time `json:"end,omitempty"` Check bool `json:"check,omitempty"` Geometry *geojson.Geometry `json:"geometry,omitempty"` Conditions []*Filter `json:"conditions,omitempty"` }
type User ¶
type User struct { Id string `json:"id"` Username string `json:"username"` Password string `json:"-"` Email string `json:"email"` IsDeleted bool `json:"is_deleted"` IsActive bool `json:"is_active"` CreatedAt time.Time `json:"created_at,string"` UpdatedAt time.Time `json:"updated_at,string"` Apikeys []Apikey `json:"apikeys"` SocialAccounts *[]interface{} `json:"social_accounts"` // contains filtered or unexported fields }
User struct of user object
func (*User) CreateApikey ¶
CreateApikey creates new apikey for user
func (*User) CreateSocialAccountIfNotExists ¶
*
- Social Accounts
CreateSocialAccountIfNotExists https://stackoverflow.com/questions/4069718/postgres-insert-if-does-not-exist-already ON CONFLICT DO NOTHING/UPDATE http://www.postgresqltutorial.com/postgresql-upsert/
func (*User) Deactivate ¶
Deactivate markers object as inactive
func (*User) IsPassword ¶
IsPassword checks if provided password/hash matches database record
func (*User) SetDatabase ¶
SetDatabase set object database reference
func (*User) SetPassword ¶
SetPassword sets user password