db

package
v0.0.0-...-7ecc845 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearMessageEvents

func ClearMessageEvents(jid string) error

func ClearRepeatedCommands

func ClearRepeatedCommands(jid string, user string) (int64, error)

func ComparePermission

func ComparePermission(perm string, command string) bool

func DeleteAlias

func DeleteAlias(name string) error

func UpdateNextDate

func UpdateNextDate(id uint, nextDate time.Time) error

func UpdateUserPermission

func UpdateUserPermission(userId string, permission string) error

func UpsertAlias

func UpsertAlias(name string, content string) error

Types

type Alias

type Alias struct {
	gorm.Model
	Name    string `gorm:"not null;unique"`
	Content string `gorm:"not null"`
}

func CreateAlias

func CreateAlias(name string, content string) (*Alias, error)

func GetAlias

func GetAlias(name string) *Alias

type MessageEvent

type MessageEvent struct {
	gorm.Model
	JID     string `gorm:"not null;column:jid;uniqueIndex:jid_content_idx"`
	Content string `gorm:"not null;uniqueIndex:jid_content_idx"`
}

func CreateMessageEvent

func CreateMessageEvent(jid string, content string) (*MessageEvent, error)

func GetMessageEvents

func GetMessageEvents(jid string) []MessageEvent

type RepeatedCommand

type RepeatedCommand struct {
	gorm.Model
	JID      string    `gorm:"not null;column:jid"`
	User     string    `gorm:"not null"`
	Content  string    `gorm:"not null"`
	Repeat   string    `gorm:"not null"`
	NextDate time.Time `gorm:"not null"`
}

func CreateRepeatedCommand

func CreateRepeatedCommand(jid string, user string, content string, repeat string, nextDate time.Time) (*RepeatedCommand, error)

func GetRepeatedCommands

func GetRepeatedCommands(jid string, user string) []RepeatedCommand

func GetRepeatedCommandsToday

func GetRepeatedCommandsToday() []RepeatedCommand

type UserPermission

type UserPermission struct {
	gorm.Model
	UserID     string `gorm:"not null;unique;column:user_id"`
	Permission string `gorm:"not null;column:permission"`
}

func GetUserPermission

func GetUserPermission(userId string) (*UserPermission, error)

Jump to

Keyboard shortcuts

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