model

package
v0.0.0-...-7aa88fd Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackupTypeManual    = "manual"
	BackupTypeAutomatic = "automatic"
)
View Source
const (
	PostTypeArticle = "article" // PostTypeArticle 内容类型-文章
	PostTypePage    = "page"    // PostTypePage 内容类型-页面
	PostTypeMicro   = "micro"   // PostTypeMicro 内容类型-微博
)

Variables

This section is empty.

Functions

func SummarySeparator

func SummarySeparator() string

func UpdateLastChange

func UpdateLastChange(tx *gorm.DB) error

func UpdateSiteParameter

func UpdateSiteParameter(sp SiteParameter) bool

Types

type BackupLog

type BackupLog struct {
	ID        uint
	Type      string
	CloudKey  string
	Others    InterfaceMap
	CreatedAt string `gorm:"time"`
}

func (BackupLog) TableName

func (bl BackupLog) TableName() string

type DBSiteParameter

type DBSiteParameter struct {
	ID     uint
	Option string
	Value  string
}

func (DBSiteParameter) TableName

func (DBSiteParameter) TableName() string

type InterfaceMap

type InterfaceMap map[string]interface{}

func (InterfaceMap) GetUint

func (iMap InterfaceMap) GetUint(key string, defVal ...uint) (val uint, has bool)

func (*InterfaceMap) Scan

func (iMap *InterfaceMap) Scan(data interface{}) error

func (InterfaceMap) ToStringMap

func (iMap InterfaceMap) ToStringMap() StringMap

func (InterfaceMap) Value

func (iMap InterfaceMap) Value() (driver.Value, error)

type InterfaceMapList

type InterfaceMapList []InterfaceMap

func (InterfaceMapList) ToStringMapList

func (v InterfaceMapList) ToStringMapList() StringMapList

type Option

type Option map[string]interface{}

func (Option) GetInt

func (opt Option) GetInt(k string) int

func (Option) GetString

func (opt Option) GetString(k string) string

func (Option) GetUint

func (opt Option) GetUint(k string) uint

func (Option) MustGet

func (opt Option) MustGet(k string) interface{}

func (Option) Set

func (opt Option) Set(k string, v interface{})

type Post

type Post struct {
	ID      uint
	URL     string `gorm:"url"`
	Title   string
	Content string
	Summary string `gorm:"-"`
	Pages   int    `gorm:"-"` // 内容分页的总页数
	Tags    StringList
	// TagsStr   string   `gorm:"column:tags"`
	Type      string `gorm:"column:type"`
	IsPinned  bool   `gorm:"column:is_pinned"`
	CreatedAt string `gorm:"time"`
}

func (*Post) AfterFind

func (p *Post) AfterFind(*gorm.DB) (err error)

type SiteParameter

type SiteParameter struct {
	Name        string `db-option:"name"`
	Description string `db-option:"description"`
	Domain      string `db-option:"domain"`
	PageSize    int    `db-option:"page_size"`
	Separator   string `db-option:"separator"`
}

func GetSiteParameter

func GetSiteParameter() *SiteParameter

type StringList

type StringList []string

func NewStringList

func NewStringList(s string) StringList

func (*StringList) Scan

func (v *StringList) Scan(data interface{}) error

func (StringList) Value

func (v StringList) Value() (driver.Value, error)

type StringMap

type StringMap map[string]string

func (StringMap) GetInt

func (strMap StringMap) GetInt(key string) (val int, ok bool)

GetInt 返回 key 对应值的 int 值 如果 key 不存在或者其值无法转换成 int 形式,则返回的 ok 值为 false

func (*StringMap) Scan

func (strMap *StringMap) Scan(data interface{}) error

func (StringMap) Value

func (strMap StringMap) Value() (driver.Value, error)

type StringMapList

type StringMapList []StringMap

func (*StringMapList) Scan

func (v *StringMapList) Scan(data interface{}) error

func (StringMapList) Value

func (v StringMapList) Value() (driver.Value, error)

type UintList

type UintList []uint

func (*UintList) Scan

func (v *UintList) Scan(data interface{}) error

func (UintList) Value

func (v UintList) Value() (driver.Value, error)

type User

type User struct {
	ID       uint
	Name     string
	Password string
}

func (User) TableName

func (u User) TableName() string

Jump to

Keyboard shortcuts

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