db

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	T_SQLITE dbTYPE = iota
	T_POSTGRESQL
)

Variables

This section is empty.

Functions

func DB

func DB() *gorm.DB

func DBType

func DBType() dbTYPE

func GetMaxCount

func GetMaxCount(cfg MaxCountCfg) int64

func Init

func Init()

Types

type FindConfig

type FindConfig struct {
	Deadline      time.Time
	Order         string
	Limit, Offset int64
	User_id       any
	Keywords      []string
	KeywordsRe    []string // Not support sqlite
	SelectKey     []string
}

type MaxCountCfg

type MaxCountCfg struct {
	Deadline   time.Time
	User_id    any
	Keywords   []string
	KeywordsRe []string // Not support sqlite
}

type PhotoInfo

type PhotoInfo struct {
	gorm.Model
	FileID         string         `gorm:"unique;not null"`
	UserID         int64          `gorm:"not null"`
	UnShare        bool           `gorm:"default:false"`
	Config         api.DrawConfig `gorm:"embedded"`
	PrePhotoID     string
	ControlPhotoID string
}

func FindImg

func FindImg(cfg FindConfig) ([]PhotoInfo, error)

type Subscribe

type Subscribe struct {
	gorm.Model
	UserID     int64 `gorm:"unique;not null"`
	FreeAmount int   `gorm:"not null"`
	Deadline   time.Time
}

type Token

type Token struct {
	Token     string `gorm:"unique;not null"`
	ValidDate uint64 `gorm:"not null"`
}

type UserDefaultCfg

type UserDefaultCfg struct {
	UserDefaultUC     string
	UserDefaultMODE   string
	UserDefaultNumber int
	UserDefaultScale  int
	UserDefaultSteps  int
}

type UserInfo

type UserInfo struct {
	UserID     int64  `gorm:"unique;not null;primary_key"`
	Passwd     string `gorm:"not null"`
	Language   string `gorm:"default:en_us"`
	SharePhoto bool   `gorm:"default:true"`
	UserDefaultCfg
}

Jump to

Keyboard shortcuts

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