dao

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCallbackData added in v0.13.0

func CreateCallbackData(data string) (uint, error)

func CreateDirForUser added in v0.13.0

func CreateDirForUser(userID uint, storageName, path string) error

func CreateUser

func CreateUser(chatID int64) error

func DeleteCallbackData added in v0.13.0

func DeleteCallbackData(id uint) error

func DeleteDirForUser added in v0.13.0

func DeleteDirForUser(userID uint, storageName, path string) error

func DeleteReceivedFile added in v0.3.0

func DeleteReceivedFile(receivedFile *ReceivedFile) error

func DeleteUser added in v0.11.0

func DeleteUser(user *User) error

func GetCallbackData added in v0.13.0

func GetCallbackData(id uint) (string, error)

func Init

func Init()

func SaveReceivedFile added in v0.8.0

func SaveReceivedFile(receivedFile *ReceivedFile) error

func UpdateUser

func UpdateUser(user *User) error

Types

type CallbackData added in v0.13.0

type CallbackData struct {
	gorm.Model
	Data string
}

type Dir added in v0.13.0

type Dir struct {
	gorm.Model
	UserID      uint
	StorageName string
	Path        string
}

func GetDirByID added in v0.13.0

func GetDirByID(id uint) (*Dir, error)

func GetDirsByUserIDAndStorageName added in v0.13.0

func GetDirsByUserIDAndStorageName(userID uint, storageName string) ([]Dir, error)

func GetUserDirs added in v0.13.0

func GetUserDirs(userID uint) ([]Dir, error)

func GetUserDirsByChatID added in v0.13.0

func GetUserDirsByChatID(chatID int64) ([]Dir, error)

type ReceivedFile added in v0.13.0

type ReceivedFile struct {
	gorm.Model
	Processing bool
	// Which chat the file is from
	ChatID int64 `gorm:"uniqueIndex:idx_chat_id_message_id;not null"`
	// Which message the file is from
	MessageID      int `gorm:"uniqueIndex:idx_chat_id_message_id;not null"`
	ReplyMessageID int
	ReplyChatID    int64
	FileName       string
}

func GetReceivedFileByChatAndMessageID

func GetReceivedFileByChatAndMessageID(chatID int64, messageID int) (*ReceivedFile, error)

type User added in v0.13.0

type User struct {
	gorm.Model
	ChatID         int64 `gorm:"uniqueIndex;not null"`
	Silent         bool
	DefaultStorage string // Default storage name
	Dirs           []Dir
}

func GetAllUsers added in v0.11.0

func GetAllUsers() ([]User, error)

func GetUserByChatID added in v0.11.0

func GetUserByChatID(chatID int64) (*User, error)

Jump to

Keyboard shortcuts

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