model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Log           *Log         `yaml:"log"`
	RootDir       string       `yaml:"root-dir"`
	Authorization string       `yaml:"authorization"`
	TelegramBot   *TelegramBot `yaml:"telegram-bot"`
}

type FileModel

type FileModel struct {
	gorm.Model
	// 转发消息的 ID
	MessageID int64 `gorm:"index"`
	// 原消息发送时间 (同一 Date 的消息被认为是同一批消息)
	ForwardDate int64 `gorm:"not null"`
	// 转发者 UserId
	UserID int64 `gorm:"index"`
	// 转发者 UserName
	UserName string `gorm:"default:''"`
	// 同一批次消息中由 From 用户发送的文本
	Text string `gorm:"default:''"`
	// 转发消息的原 json 格式数据
	Json datatypes.JSONType[*tgbotapi.Message] `gorm:"not null"`

	// 文件类型 nullable
	FileType FileType `gorm:"default:''"`
	// 文件本地储存路径 nullable
	FilePath string `gorm:"default:''"`
	// 文件大小
	FileSize int64 `gorm:"default:0"`
	// 文件ID
	FileID string `gorm:"default:''"`
}

func (*FileModel) GetForwardFrom

func (m *FileModel) GetForwardFrom() string

GetForwardFrom 获取原消息发送者的信息

func (*FileModel) IsValid

func (m *FileModel) IsValid() bool

type FileType

type FileType string
const (
	// Text 纯文本
	Text     FileType = "Text"
	Photo    FileType = "Photo"
	Voice    FileType = "Voice"
	Video    FileType = "Video"
	Document FileType = "Document"
)

func (*FileType) Scan

func (ft *FileType) Scan(value interface{}) error

Scan 实现 sql.Scanner 接口,从数据库读取值并将其转换回 FileType

func (FileType) Value

func (ft FileType) Value() (driver.Value, error)

type Log

type Log struct {
	ForceNew bool          `yaml:"force-new,omitempty"`
	Level    string        `yaml:"level,omitempty"`
	Aging    time.Duration `yaml:"aging,omitempty"`
	Colorful bool          `yaml:"colorful,omitempty"`
}

type Static

type Static struct {
	// Rows 记录数
	Rows int64
	// MB 占用的储存空间
	MB float64
}

type TelegramBot

type TelegramBot struct {
	Debug    bool   `yaml:"debug,omitempty"`
	Endpoint string `yaml:"endpoint,omitempty"`
	Token    string `yaml:"token,omitempty"`
}

type UserModel

type UserModel struct {
	gorm.Model
	UserID int64
}

UserModel 授权用户记录

Jump to

Keyboard shortcuts

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