models

package
v0.0.0-...-1c9d33f Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB)

Migrate automigrates models using ORM

Types

type Company

type Company struct {
	gorm.Model
	Name    string `sql:"type:varchar(100);"`
	Email   string `sql:"type:varchar(150);"`
	Color   string `sql:"type:varchar(10);"`
	Code    string
	Allowed int
}

Company data model

func (*Company) Read

func (u *Company) Read(m common.JSON)

func (*Company) Serialize

func (u *Company) Serialize() common.JSON

Serialize serializes company data

type Log

type Log struct {
	gorm.Model
	IP      string `sql:"type:varchar(50);"`
	Message string `sql:"type:text;"`
	Email   User   `gorm:"foreignkey:UserID"`
	EmailID uint
}

Log data model

func (*Log) Read

func (l *Log) Read(m common.JSON)

func (*Log) Serialize

func (l *Log) Serialize() common.JSON

Serialize serializes log data

type Role

type Role struct {
	gorm.Model
	Name       string
	Statistics uint `sql:"-"`
}

Role data model

func (*Role) Read

func (p *Role) Read() common.JSON

Read role data

func (*Role) Serialize

func (u *Role) Serialize() common.JSON

Serialize serializes role data

type User

type User struct {
	gorm.Model
	Username     string `sql:"type:varchar(45);"`
	DisplayName  string `sql:"type:varchar(100);"`
	PasswordHash string
	Email        string `sql:"type:varchar(150);"`
	RoleID       uint   `sql:"default: 1"`
	Role         Role   `json:"-"`
}

User data model

func (*User) Read

func (u *User) Read(m common.JSON)

func (*User) Serialize

func (u *User) Serialize() common.JSON

Serialize serializes user data

Jump to

Keyboard shortcuts

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