models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 1 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          uint   `gorm:"primary_key" json:"id"`
	Name        string `gorm:"size:255;not null" json:"name"`
	GuardName   string `gorm:"size:255;not null;index" json:"guard_name"`
	Description string `gorm:"size:255" json:"description"`

	// Time
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Permission represents the database model of permissions

func (Permission) TableName

func (Permission) TableName() string

TableName sets the table name

type Role

type Role struct {
	ID          uint   `gorm:"primary_key" json:"id"`
	Name        string `gorm:"size:255;not null" json:"name"`
	GuardName   string `gorm:"size:255;not null;index" json:"guard_name"`
	Description string `gorm:"size:255;" json:"description"`

	// Many to Many
	Permissions []Permission `gorm:"many2many:role_permissions;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"permissions"`

	// Time
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Role represents the database model of roles

func (Role) TableName

func (Role) TableName() string

TableName sets the table name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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