model

package
v1.9.9 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: AGPL-3.0 Imports: 21 Imported by: 4

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CheckToken

func CheckToken(token string) int64

func CreateBackup

func CreateBackup(path string)

func DeleteToken

func DeleteToken(token string) error

func GenerateAllModel added in v1.7.8

func GenerateAllModel() []any

func GenerateJWT

func GenerateJWT(name string) (string, error)

func Init

func Init() *gorm.DB

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"`
	ChallengeMethod       string         `json:"challenge_method"`
	DnsCredentialID       int            `json:"dns_credential_id"`
	DnsCredential         *DnsCredential `json:"dns_credential,omitempty"`
	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 ChatGPTLog added in v1.7.8

type ChatGPTLog struct {
	Name    string `json:"name"`
	Content JSON   `json:"content" gorm:"serializer:json"`
}

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 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 DnsCredential added in v1.8.0

type DnsCredential struct {
	Model
	Name     string      `json:"name"`
	Config   *dns.Config `json:"config,omitempty" gorm:"serializer:json"`
	Provider string      `json:"provider"`
}

type JSON added in v1.7.8

type JSON []openai.ChatCompletionMessage

func (*JSON) Scan added in v1.7.8

func (j *JSON) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (*JSON) Value added in v1.7.8

func (j *JSON) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

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 Method added in v1.7.8

type Method interface {
	// FirstByID Where("id=@id")
	FirstByID(id int) (*gen.T, error)
	// DeleteByID update @@table set deleted_at=strftime('%Y-%m-%d %H:%M:%S','now') where id=@id
	DeleteByID(id int) error
}

type Model

type Model struct {
	ID        int             `gorm:"primary_key" json:"id"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
	DeletedAt *gorm.DeletedAt `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"`
}

type Site added in v1.8.0

type Site struct {
	Model
	Path     string `json:"path"`
	Advanced bool   `json:"advanced"`
}

Jump to

Keyboard shortcuts

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