database

package
v0.0.0-...-ea69daf Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Gdb *gorm.DB

Functions

func AddAdvertise

func AddAdvertise(advertise Advertise) (err error)

func DeleteAdvertise

func DeleteAdvertise(id int64) (err error)

func IncrementNumberOfSpeeches

func IncrementNumberOfSpeeches(user *UserInfo) error

func IncrementVerificationTimes

func IncrementVerificationTimes(user *UserInfo) error

func SaveUserInfo

func SaveUserInfo(user *UserInfo) error

Types

type Advertise struct {
	BaseModel
	Title          string          `gorm:"column:title" json:"title"`
	Url            string          `gorm:"column:url" json:"url"`
	Sort           int             `gorm:"column:sort" json:"sort"`
	ValidityPeriod carbon.DateTime `gorm:"column:validity_period" json:"validity_period"`
}

func AllAdvertise

func AllAdvertise() (advertises []Advertise, err error)

func GetEfficientAdvertise

func GetEfficientAdvertise() (advertises []Advertise, err error)

func (Advertise) TableName

func (Advertise) TableName() string

type BaseModel

type BaseModel struct {
	ID        int64           `gorm:"column:id;primary_key" json:"id"`
	CreatedAt carbon.DateTime `gorm:"column:created_at" json:"created_at"`
	UpdatedAt carbon.DateTime `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt gorm.DeletedAt  `gorm:"column:deleted_at" json:"deleted_at"`
}

type UserInfo

type UserInfo struct {
	BaseModel
	TelegramUserId    int64           `gorm:"uniqueIndex:idx_chat_user,column:telegram_user_id" json:"telegram_user_id"`
	TelegramChatId    int64           `gorm:"uniqueIndex:idx_chat_user,column:telegram_chat_id" json:"telegram_chat_id"`
	JoinedTime        carbon.DateTime `gorm:"column:joined_time" json:"joined_time"`
	NumberOfSpeeches  int64           `gorm:"column:number_of_speeches" json:"number_of_speeches"`
	VerificationTimes int64           `gorm:"column:verification_times" json:"verification_times"`
}

func GetUserInfo

func GetUserInfo(user *UserInfo) (*UserInfo, error)

func (UserInfo) TableName

func (UserInfo) TableName() string

Jump to

Keyboard shortcuts

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