model

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	IOSDeviceID     = 1
	AndroidDeviceID = 2
	DesktopDeviceID = 3
	WebDeviceID     = 4
	ConsoleDeviceID = 5
	LinuxDeviceID   = 6
	WindowsDeviceID = 7

	IOSDeviceStr     = "IOS"
	AndroidDeviceStr = "Android"
	DesktopDeviceStr = "Desktop"
	WebDeviceStr     = "Web"
	ConsoleDeviceStr = "Console"
	LinuxDeviceStr   = "Linux"
	WindowsDeviceStr = "Windows"
)
View Source
const SuperAdmin = "super_admin"

Variables

Functions

func DeviceIDToName

func DeviceIDToName(num int) string

func DeviceNameToID

func DeviceNameToID(name string) int

Types

type AuthToken

type AuthToken struct {
	Auth Token `json:"auth"`
	User User  `json:"user"`
}

type Permission

type Permission struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

func (Permission) TableName

func (m Permission) TableName() string

type RefreshToken

type RefreshToken struct {
	UserID    int       `json:"user_id"`
	DeviceID  int       `json:"device_id"`
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`

	User *User `json:"user"`
}

func (RefreshToken) TableName

func (m RefreshToken) TableName() string

type Role

type Role struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	RolePermissions []RolePermission `json:"role_permissions"`
}

func (Role) TableName

func (m Role) TableName() string

type RolePermission

type RolePermission struct {
	RoleID       int  `json:"role_id"`
	PermissionID int  `json:"permission_id"`
	Read         bool `json:"read"`
	Write        bool `json:"write"`
	Exec         bool `json:"exec"`

	Permission *Permission `json:"permission"`
}

func (RolePermission) TableName

func (m RolePermission) TableName() string

type Token

type Token struct {
	Token        string  `json:"token"`
	RefreshToken string  `json:"refresh_token"`
	ExpiresAt    float64 `json:"expires_at"`
	TokenType    string  `json:"token_type"`
	UserID       int     `json:"user_id"`
}

type User

type User struct {
	ID         int     `json:"id"`
	Login      string  `json:"login"`
	FirstName  string  `json:"name"`
	SecondName *string `json:"second_name"`
	LastName   *string `json:"last_name"`
	Password   string  `json:"password"`
	Email      *string `json:"email"`
	Phone      *string `json:"phone"`

	Roles []Role `json:"roles"`
}

func (User) TableName

func (m User) TableName() string

type UserRole

type UserRole struct {
	UserID int `json:"user_id"`
	RoleID int `json:"role_id"`
}

func (UserRole) TableName

func (m UserRole) TableName() string

Jump to

Keyboard shortcuts

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