model

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: AGPL-3.0 Imports: 11 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"`
}

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

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 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"`
}

Jump to

Keyboard shortcuts

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