model

package
v1.5.0-beta9 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: AGPL-3.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(model interface{})

func CheckToken

func CheckToken(token string) int64

func CreateBackup

func CreateBackup(path string)

func DeleteToken

func DeleteToken(token string) error

func GenerateJWT

func GenerateJWT(name string) (string, error)

func Init

func Init()

Types

type Auth

type Auth struct {
	Model

	Name     string `json:"name"`
	Password string `json:"-"`
}

func GetUser

func GetUser(name string) (user Auth, err error)

type AuthToken

type AuthToken struct {
	Token string `json:"token"`
}

type Cert

type Cert struct {
	Model
	Domain             string `json:"domain"`
	SSLCertificatePath string `json:"ssl_certificate_path"`
}

func FirstCert

func FirstCert(domain string) (c Cert, err error)

func FirstOrCreateCert

func FirstOrCreateCert(domain string) (c Cert, err error)

func GetAutoCertList

func GetAutoCertList() (c []Cert)

func (*Cert) Remove

func (c *Cert) Remove() error

func (*Cert) Updates added in v1.5.0

func (c *Cert) Updates(n *Cert) error

type ConfigBackup

type ConfigBackup struct {
	Model

	Name     string `json:"name"`
	FilePath string `json:"file_path"`
	Content  string `json:"content" gorm:"type:text"`
}

func GetBackup

func GetBackup(id int) (config ConfigBackup)

type ConfigBackupListItem

type ConfigBackupListItem struct {
	Model

	Name     string `json:"name"`
	FilePath string `json:"file_path"`
}

func GetBackupList

func GetBackupList(path string) (configs []ConfigBackupListItem)

type Curd

type Curd struct {
	Model interface{}
}

func NewCurd

func NewCurd(Model interface{}) *Curd

func (*Curd) Add

func (c *Curd) Add(value interface{}) (err error)

func (*Curd) Delete

func (c *Curd) Delete(value interface{}, conds ...interface{}) (err error)

func (*Curd) Edit

func (c *Curd) Edit(orig interface{}, new interface{}) (err error)

func (*Curd) First

func (c *Curd) First(dest interface{}, conds ...interface{}) (err error)

func (*Curd) GetList

func (c *Curd) GetList(dest interface{}) (err error)

type DataList added in v1.5.0

type DataList struct {
	Data       interface{} `json:"data"`
	Pagination Pagination  `json:"pagination,omitempty"`
}

func GetListWithPagination added in v1.5.0

func GetListWithPagination(models interface{},
	c *gin.Context, totalRecords int64) (result DataList)

func GetUserList added in v1.5.0

func GetUserList(c *gin.Context, username interface{}) (data DataList)

type JWTClaims

type JWTClaims struct {
	Name string `json:"name"`
	jwt.StandardClaims
}

type Log

type Log struct {
	Model
	Title   string `json:"title"`
	Content string `json:"content"`
}

type Model

type Model struct {
	ID        uint       `gorm:"primary_key" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `gorm:"index" json:"deleted_at"`
}

type Pagination added in v1.5.0

type Pagination struct {
	Total       int64 `json:"total"`
	PerPage     int   `json:"per_page"`
	CurrentPage int   `json:"current_page"`
	TotalPages  int64 `json:"total_pages"`
}

Jump to

Keyboard shortcuts

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