db

package
v0.0.0-...-16e1b16 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddMessageParams

type AddMessageParams struct {
	ID        string
	ChatID    string
	Role      string
	Content   string
	Tokens    int32
	Model     string
	Erased    bool
	OrderMsg  int32
	CreatedAt time.Time
}

type Chat

type Chat struct {
	ID               string
	UserID           string
	InitialMessageID string
	Status           string
	TokenUsage       int32
	Model            string
	ModelMaxTokens   int32
	Temperature      float64
	TopP             float64
	N                int32
	Stop             string
	MaxTokens        int32
	PresencePenalty  float64
	FrequencyPenalty float64
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

type CreateChatParams

type CreateChatParams struct {
	ID               string
	UserID           string
	InitialMessageID string
	Status           string
	TokenUsage       int32
	Model            string
	ModelMaxTokens   int32
	Temperature      float64
	TopP             float64
	N                int32
	Stop             string
	MaxTokens        int32
	PresencePenalty  float64
	FrequencyPenalty float64
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Message

type Message struct {
	ID        string
	ChatID    string
	Role      string
	Content   string
	Tokens    int32
	Model     string
	Erased    bool
	OrderMsg  int32
	CreatedAt time.Time
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) AddMessage

func (q *Queries) AddMessage(ctx context.Context, arg AddMessageParams) error

func (*Queries) CreateChat

func (q *Queries) CreateChat(ctx context.Context, arg CreateChatParams) error

func (*Queries) DeleteChatMessages

func (q *Queries) DeleteChatMessages(ctx context.Context, chatID string) error

func (*Queries) DeleteErasedChatMessages

func (q *Queries) DeleteErasedChatMessages(ctx context.Context, chatID string) error

func (*Queries) FindChatByID

func (q *Queries) FindChatByID(ctx context.Context, id string) (Chat, error)

func (*Queries) FindErasedMessagesByChatID

func (q *Queries) FindErasedMessagesByChatID(ctx context.Context, chatID string) ([]Message, error)

func (*Queries) FindMessagesByChatID

func (q *Queries) FindMessagesByChatID(ctx context.Context, chatID string) ([]Message, error)

func (*Queries) SaveChat

func (q *Queries) SaveChat(ctx context.Context, arg SaveChatParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type SaveChatParams

type SaveChatParams struct {
	UserID           string
	InitialMessageID string
	Status           string
	TokenUsage       int32
	Model            string
	ModelMaxTokens   int32
	Temperature      float64
	TopP             float64
	N                int32
	Stop             string
	MaxTokens        int32
	PresencePenalty  float64
	FrequencyPenalty float64
	UpdatedAt        time.Time
	ID               string
}

Jump to

Keyboard shortcuts

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