models

package
v1.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Permission

type Permission struct {
	ID          uint64       `gorm:"primarykey"`
	Name        string       `gorm:"uniqueIndex;not null;size:256"`
	Description string       `gorm:"type:text"`
	CreatedAt   time.Time    `gorm:"type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP"`
	UpdatedAt   time.Time    `gorm:"type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
	DeletedAt   sql.NullTime `gorm:"type:timestamp;"`
	Users       []User       `gorm:"many2many:user_permissions"`
	Roles       []Role       `gorm:"many2many:role_permissions"`
}

type PersonalAccessToken

type PersonalAccessToken struct {
	ID         uint64         `gorm:"autoIncrement;primaryKey"`
	UserId     uint64         `gorm:"foreignkey:id;references:user_id;constraint:OnUpdate:SET NULL,OnDelete:CASCADE;"`
	Name       string         `gorm:"index;size:255"`
	Token      string         `gorm:"uniqueIndex;size:64"`
	UserAgent  string         `gorm:"type:text"`
	IpAddress  string         `gorm:"index;size:45"`
	Abilities  datatypes.JSON `gorm:"type:json"`
	LastUsedAt sql.NullTime   `gorm:"type:timestamp"`
	ExpiresAt  time.Time      `gorm:"type:timestamp;"`
	CreatedAt  time.Time      `gorm:"type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP"`
	UpdatedAt  time.Time      `gorm:"type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
	DeletedAt  sql.NullTime   `gorm:"type:timestamp;"`
	User       *User
}

func (*PersonalAccessToken) GetToken

func (p *PersonalAccessToken) GetToken() string

type Role

type Role struct {
	ID          uint64       `gorm:"primarykey"`
	Name        string       `gorm:"uniqueIndex;not null;size:256"`
	Description string       `gorm:"type:text"`
	CreatedAt   time.Time    `gorm:"type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP"`
	UpdatedAt   time.Time    `gorm:"type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
	DeletedAt   sql.NullTime `gorm:"type:timestamp;"`
	Permissions []Permission `gorm:"many2many:role_permissions"`
	Users       []User       `gorm:"many2many:user_roles"`
}

type User

type User struct {
	ID              uint64       `gorm:"primarykey;autoIncrement"`
	Name            string       `goem:"index;not null;size:256"`
	Email           *string      `gorm:"uniqueIndex;not null;size:256"`
	Password        string       `gorm:"uniqueIndex;not null;size:64"`
	EmailVerifiedAt sql.NullTime `gorm:"type:timestamp"`
	LoginAt         sql.NullTime `gorm:"type:timestamp"`
	CreatedAt       time.Time    `gorm:"type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP"`
	UpdatedAt       time.Time    `gorm:"type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
	DeletedAt       sql.NullTime `gorm:"type:timestamp;"`
	Permissions     []Permission `gorm:"many2many:user_permissions"`
	Roles           []Role       `gorm:"many2many:user_roles"`
}

Jump to

Keyboard shortcuts

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