db

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 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 ReplaceColon added in v0.2.3

func ReplaceColon(s string) string

Types

type Config added in v0.2.3

type Config struct {
	Tag               string  `json:"tag,omitempty" yaml:"tag,omitempty"`
	Mode              string  `json:"mode,omitempty" yaml:"mode,omitempty"`
	Num               int     `json:"num,omitempty" yaml:"num,omitempty"`
	Steps             int     `json:"steps,omitempty" yaml:"steps,omitempty"`
	Seed              uint32  `json:"seed,omitempty" yaml:"seed,omitempty"`
	CfgScale          int     `json:"scale,omitempty" yaml:"scale,omitempty"`
	Width             int     `json:"width" yaml:"width"`
	Height            int     `json:"height" yaml:"height"`
	Model             string  `json:"model,omitempty" yaml:"model,omitempty"`
	Uc                string  `json:"uc,omitempty" yaml:"uc,omitempty"`
	PrePhotoID        string  `json:"pre_photo_id,omitempty" yaml:"pre_photo_id,omitempty"`
	Strength          float64 `json:"strength,omitempty" yaml:"strength,omitempty"`
	ControlPhotoID    string  `json:"control_photo_id,omitempty" yaml:"control_photo_id,omitempty"`
	ControlPreprocess string  `json:"control_preprocess,omitempty" yaml:"control_preprocess,omitempty"`
	ControlProcess    string  `json:"control_process,omitempty" yaml:"control_process,omitempty"`
}

func (*Config) Fomate2TgHTML added in v0.2.3

func (c *Config) Fomate2TgHTML() []byte

func (*Config) Fomate2TgMdV2 added in v0.2.3

func (c *Config) Fomate2TgMdV2() []byte

type DB

type DB struct {
	// contains filtered or unexported fields
}

func New added in v0.2.3

func New(dsn string) *DB

func (*DB) DB added in v0.2.3

func (db *DB) DB() *gorm.DB

func (*DB) DBType added in v0.2.3

func (db *DB) DBType() dbTYPE

func (*DB) FindImg added in v0.2.3

func (d *DB) FindImg(cfg FindConfig) ([]PhotoInfo, error)

func (*DB) GetMaxCount added in v0.2.3

func (d *DB) GetMaxCount(cfg MaxCountCfg) int64

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  Config `gorm:"embedded"`
}

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