models

package
v0.0.0-...-580ceab Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MyTableNameHandler = func(db *gorm.DB, defaultTableName string) string {
	return "pg_" + defaultTableName
}

Functions

func ClearUserCache

func ClearUserCache() (dc int64, err error)

ClearUserCache clear all tokens from redis

func CreateIndex

func CreateIndex(flag bool) error

func CreateTables

func CreateTables(drop bool) error

func DownloadPics

func DownloadPics(ctx context.Context, base string, srcs []string, w int) error

func Extract

func Extract(url string) ([]string, error)

func Extract2

func Extract2(url string) (next string, links []string, pics []string, err error)

func NewCaptchaStore

func NewCaptchaStore(expiration time.Duration) *captchaStore

func NewEsCli

func NewEsCli()

NewEsCli new es cli in global scope

func NewGormDB

func NewGormDB()

func NewRedisCli

func NewRedisCli()

NewRedisCli new redis cli in global scope

func NovelScrapy

func NovelScrapy(p bool, bookid string, skip int) error

Types

type Atom

type Atom struct {
	BaseModel
	Key       string `json:"key" gorm:"type:varchar(100);unique_index;not null"`
	Name      string `json:"name"`
	NameEn    string `json:"name_en"`
	EnAbbr    string `json:"en_abbr"`
	Level     int    `json:"level" gorm:"default:1"`
	Keyword   string `json:"keyword"`
	Remark    string `json:"remark" gorm:"type:varchar(300)"`
	Options   string `json:"options" gorm:"type:varchar(500)"`
	Etype     string `json:"etype" gorm:"type:varchar(50)"`
	Eanalyzer string `json:"eanalyzer"`
}

func (*Atom) Save

func (a *Atom) Save() error

type BaseModel

type BaseModel struct {
	ID        uint       `json:"id" gorm:"primary_key"`
	CreatedAt time.Time  `json:"createTime"`
	UpdatedAt time.Time  `json:"updateTime"`
	DeletedAt *time.Time `json:"-" sql:"index"`
}

type Compound

type Compound struct {
	BaseModel
	Code        string `json:"code" gorm:"type:varchar(100);unique_index;not null"`
	Name        string `json:"name"`
	Description string `json:"description" gorm:"type:varchar(500)"`
	Remark      string `json:"remark" gorm:"type:varchar(300)"`
	DbName      string `json:"db_name"`
}

type CompoundElem

type CompoundElem struct {
	BaseModel
	CompoundID uint `json:"compound_id"`
	MoleculeID uint `json:"molecule_id"`
	Position   int  `json:"position" gorm:"default:1"`
}

type DocVerify

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

func (*DocVerify) Verify

func (dv *DocVerify) Verify()

type Doct

type Doct struct {
	Id         string     `json:"id" dt:"keyword"`
	Name       string     `json:"name,omitempty" dt:"keyword"`
	Key        string     `json:"key" dt:"keyword"`
	Desc       string     `json:"desc,omitempty" dt:"text"`
	CreateDate *time.Time `json:"createDate,omitempty" dt:"date"`
	Position   int
}

type KGroup

type KGroup struct {
}

type KeyDefine

type KeyDefine struct {
	Id     string
	Code   string
	Groups []struct {
		Id       string
		Key      string
		Name     string
		Rank     int
		MetaKeys []struct {
			Id       string
			Key      string
			Name     string
			Keyword  string
			Etype    string
			Optional string
		}
	}
}

type MeizituCrawl

type MeizituCrawl struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMeizituCrawl

func NewMeizituCrawl(url string, limit int) *MeizituCrawl

func (*MeizituCrawl) Crawl

func (mc *MeizituCrawl) Crawl()

type Molecule

type Molecule struct {
	BaseModel
	Key     string `json:"key" gorm:"type:varchar(100);unique_index;not null"`
	Name    string `json:"name"`
	NameEn  string `json:"name_en"`
	Keyword string `json:"keyword"`
	Remark  string `json:"remark" gorm:"type:varchar(300)"`
}

type User

type User struct {
	Id        string     `json:"id" dt:"keyword"`
	Name      string     `json:"name" dt:"keyword"`
	Password  string     `json:"password" dt:"keyword"`
	TelNumber string     `json:"telNumberm,omitempty" dt:"keyword"`
	Address   string     `json:"address,omitempty" dt:"text"`
	Birthday  *time.Time `json:"birthday,omitempty" dt:"date"`
}

func (*User) Create

func (u *User) Create() (err error)

func (*User) List

func (u *User) List() ([]*User, error)

type UserVo

type UserVo struct {
	*User
	TokenId string `json:"tokenId"`
}

func CurrentUserWithToken

func CurrentUserWithToken(token string) (u *UserVo, err error)

func (*UserVo) Login

func (u *UserVo) Login() (string, error)

UserLogin handle the login and return a tokenId

func (*UserVo) Logout

func (u *UserVo) Logout() error

func (*UserVo) String

func (u *UserVo) String() string

Jump to

Keyboard shortcuts

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