db

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserStateNone = iota
	UserStateSearchGroup
	UserStateSearchTeacher
)
View Source
const EventTypeMessage int64 = 1
View Source
const EventTypeMessageEdited int64 = 2
View Source
const EventTypeReplyCallback int64 = 3
View Source
const MetricFlagFirstMessage = 1

Variables

This section is empty.

Functions

func Init

func Init() (*sql.DB, error)

func WriteMetric

func WriteMetric(db *sql.DB, metric Metric) error

Types

type Metric

type Metric struct {
	UserId    int64
	ChatId    int64
	EventType int64
	Content   string
	MediaType string
	MediaId   string
	AlbumId   string
	ReplyTo   int64
	Flags     int64
}

type User

type User struct {
	Id              int64
	Messages        int64
	State           int64
	Firstname       string
	Lastname        *string
	Username        *string
	Faculty         *string
	EducationForm   *string
	Course          *string
	StudyGroup      *string
	IsAdmin         bool
	KeyboardVersion int64
	Settings        *UserSettings
	BannedUntil     time.Time
	// contains filtered or unexported fields
}

func GetAdminUsers

func GetAdminUsers(db *sql.DB) ([]User, error)

func GetOrCreateUser

func GetOrCreateUser(db *sql.DB, id int64, firstname string) (*User, error)

func (*User) Save

func (user *User) Save() error

type UserSettings

type UserSettings struct {
	UserId         int64
	ShowGroups     int64
	ShowTeacher    bool
	HiddenSubjects []string
	// contains filtered or unexported fields
}

func GetOrCreateUserSettings

func GetOrCreateUserSettings(db *sql.DB, id int64) (*UserSettings, error)

func (*UserSettings) Save

func (settings *UserSettings) Save() error

Jump to

Keyboard shortcuts

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