models

package
v0.0.0-...-791dfb5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case struct {
	basemodel.BaseModel
	Location   postgres.Jsonb `json:"location" gorm:"column:location"`
	DataDetail postgres.Jsonb `json:"data_detail" gorm:"column:data_detail"`
}

Case main type

func (*Case) Create

func (model *Case) Create() error

Create func

func (*Case) Delete

func (model *Case) Delete() error

Delete func

func (*Case) FindPaged

func (model *Case) FindPaged(page int, rows int, orderby []string, sort []string, filter interface{}) (basemodel.PagedFindResult, error)

PagedFindFilter func

func (*Case) FindSingle

func (model *Case) FindSingle(filter interface{}) error

SingleFindFilter func

func (*Case) FindbyID

func (model *Case) FindbyID(id uint64) error

FindbyID func

func (*Case) FirstOrCreate

func (model *Case) FirstOrCreate() error

FirstOrCreate create if not exist, or skip if exist

func (*Case) Save

func (model *Case) Save() error

Save func

type Client

type Client struct {
	basemodel.BaseModel
	Name   string `json:"name" gorm:"column:name"`
	Key    string `json:"key" gorm:"column:key"`
	Secret string `json:"secret" gorm:"column:secret"`
}

Client struct

func (*Client) BeforeCreate

func (model *Client) BeforeCreate() error

BeforeCreate callback

func (*Client) Create

func (model *Client) Create() error

Create func

func (*Client) Delete

func (model *Client) Delete() error

Delete func

func (*Client) FindbyID

func (model *Client) FindbyID(id uint64) error

FindbyID func

func (*Client) Save

func (model *Client) Save() error

Save func

func (*Client) SingleFindFilter

func (model *Client) SingleFindFilter(filter interface{}) error

SingleFindFilter func

type Edu

type Edu struct {
	basemodel.BaseModel
	Title       string `json:"title" gorm:"column:title"`
	Description string `json:"description" gorm:"column:description"`
}

Edu main type

func (*Edu) Create

func (model *Edu) Create() error

Create func

func (*Edu) Delete

func (model *Edu) Delete() error

Delete func

func (*Edu) FindPaged

func (base *Edu) FindPaged(filter interface{}) (basemodel.PagedFindResult, error)

PagedFindFilter func

func (*Edu) FindSingle

func (model *Edu) FindSingle(filter interface{}) error

SingleFindFilter func

func (*Edu) FindbyID

func (model *Edu) FindbyID(id uint64) error

FindbyID func

func (*Edu) FirstOrCreate

func (model *Edu) FirstOrCreate() error

FirstOrCreate create if not exist, or skip if exist

func (*Edu) Save

func (model *Edu) Save() error

Save func

type Roles

type Roles struct {
	basemodel.BaseModel
	Name        string         `json:"name" gorm:"column:name"`
	Description string         `json:"description" gorm:"column:description"`
	System      string         `json:"system" gorm:"column:system"`
	Status      string         `json:"status" gorm:"column:status" sql:"DEFAULT:active"`
	Permissions pq.StringArray `json:"permissions" gorm:"column:permissions"`
}

Roles main type

func (*Roles) Create

func (model *Roles) Create() error

Create new

func (*Roles) Delete

func (model *Roles) Delete() error

Delete role

func (*Roles) FilterSearchSingle

func (model *Roles) FilterSearchSingle(filter interface{}) error

FilterSearchSingle use filter to find one role

func (*Roles) FindFilter

func (model *Roles) FindFilter(limit int, offset int, orderby []string, sort []string, filter interface{}) (interface{}, error)

FindFilter use filter to find all matching role

func (*Roles) FindbyID

func (model *Roles) FindbyID(id uint64) error

FindbyID self explanatory

func (*Roles) PagedFindFilter

func (model *Roles) PagedFindFilter(page int, rows int, orderby []string, sort []string, filter interface{}) (basemodel.PagedFindResult, error)

PagedFindFilter use filter to find all matching role, return using paging format

func (*Roles) Save

func (model *Roles) Save() error

Save role

type User

type User struct {
	basemodel.BaseModel
	Roles      pq.Int64Array `json:"roles" gorm:"column:roles"`
	Username   string        `json:"username" gorm:"column:username;type:varchar(255);unique;not null"`
	Email      string        `json:"email" gorm:"column:email;type:varchar(255)"`
	Phone      string        `json:"phone" gorm:"column:phone;type:varchar(255)"`
	Password   string        `json:"password" gorm:"column:password;type:text;not null"`
	Status     string        `json:"status" gorm:"column:status;type:boolean" sql:"DEFAULT:TRUE"`
	FirstLogin bool          `json:"first_login" gorm:"column:first_login;type:boolean" sql:"DEFAULT:TRUE"`
}

User main type

func (*User) BeforeCreate

func (model *User) BeforeCreate() (err error)

BeforCreate gorm callback hook

func (*User) ChangePassword

func (model *User) ChangePassword(rawpassword string) error

ChangePassword update password to encrypted. does not save

func (*User) Create

func (model *User) Create() error

Create func

func (*User) Delete

func (model *User) Delete() error

Delete func

func (*User) FilterSearchSingle

func (model *User) FilterSearchSingle(filter interface{}) error

FilterSearchSingle func

func (*User) FindbyID

func (model *User) FindbyID(id uint64) error

FindbyID func

func (*User) FirstLoginChangePassword

func (model *User) FirstLoginChangePassword(password string)

FirstLoginChangePassword set new password and first login to false

func (*User) PagedFilterSearch

func (model *User) PagedFilterSearch(page int, rows int, orderby []string, sorts []string, filter interface{}) (basemodel.PagedFindResult, error)

PagedFilterSearch func

func (*User) Save

func (model *User) Save() error

Save func

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL