db

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMessage

func AddMessage(chatID int, role, apiName, content string) error

func CloseDB

func CloseDB()

func CreateChat

func CreateChat(title string) (int, error)

func DeleteAPIKey

func DeleteAPIKey(apiName string) error

func DeleteChat added in v1.4.0

func DeleteChat(chatID int) error

func FlushDB added in v1.3.1

func FlushDB() error

func GetAPIKey

func GetAPIKey(apiName string) (string, error)

func GetAllAPIKeys

func GetAllAPIKeys() ([]struct {
	APIName string
	APIKey  string
}, error)

func InitDB

func InitDB() error

func MigrateDatabase added in v1.4.0

func MigrateDatabase() error

func SetAPIKey

func SetAPIKey(apiName, apiKey string) error

func UpdateChatContext added in v1.4.0

func UpdateChatContext(chatID int, context string) error

func UpdateChatTitle added in v1.4.0

func UpdateChatTitle(chatID int, newTitle string) error

Types

type Chat

type Chat struct {
	ID        int
	Title     string
	Context   string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func GetChat added in v1.4.0

func GetChat(chatID int) (Chat, error)

func GetChats

func GetChats() ([]Chat, error)

Jump to

Keyboard shortcuts

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