model

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: AGPL-3.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

View Source
const (
	AutoCertEnabled  = 1
	AutoCertDisabled = -1
)

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
	Name                  string         `json:"name"`
	Domains               pq.StringArray `json:"domains" gorm:"type:text[]"`
	Filename              string         `json:"filename"`
	SSLCertificatePath    string         `json:"ssl_certificate_path"`
	SSLCertificateKeyPath string         `json:"ssl_certificate_key_path"`
	AutoCert              int            `json:"auto_cert"`
	Log                   string         `json:"log"`
}

func FirstCert

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

func FirstCertByID added in v1.7.0

func FirstCertByID(id int) (c Cert, err error)

func FirstOrCreateCert

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

func GetAutoCertList

func GetAutoCertList() (c []*Cert)

func GetCertList added in v1.7.0

func GetCertList(name, domain string) (c []Cert)

func (*Cert) ClearLog added in v1.7.6

func (c *Cert) ClearLog()

func (*Cert) Insert added in v1.7.6

func (c *Cert) Insert() error

func (*Cert) Remove

func (c *Cert) Remove() error

func (*Cert) Updates added in v1.5.0

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

type CertDomains added in v1.7.6

type CertDomains []string

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