db

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(dir string) (*sql.DB, error)

func Schema

func Schema() string

Types

type AddPromptParams

type AddPromptParams struct {
	SessionID   string    `json:"session_id"`
	Agent       string    `json:"agent"`
	State       string    `json:"state"`
	HistoryLen  int64     `json:"history_len"`
	System      string    `json:"system"`
	Request     string    `json:"request"`
	CreatedAt   time.Time `json:"created_at"`
	MachTimeSum int64     `json:"mach_time_sum"`
	MachTime    string    `json:"mach_time"`
}

type AddPromptResponseParams

type AddPromptResponseParams struct {
	Response sql.NullString `json:"response"`
	ID       int64          `json:"id"`
}

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 Prompt

type Prompt struct {
	ID          int64          `json:"id"`
	SessionID   string         `json:"session_id"`
	Agent       string         `json:"agent"`
	State       string         `json:"state"`
	System      string         `json:"system"`
	HistoryLen  int64          `json:"history_len"`
	Request     string         `json:"request"`
	Response    sql.NullString `json:"response"`
	CreatedAt   time.Time      `json:"created_at"`
	MachTimeSum int64          `json:"mach_time_sum"`
	MachTime    string         `json:"mach_time"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddPrompt

func (q *Queries) AddPrompt(ctx context.Context, arg AddPromptParams) (int64, error)

func (*Queries) AddPromptResponse

func (q *Queries) AddPromptResponse(ctx context.Context, arg AddPromptResponseParams) error

func (*Queries) DropPrompts

func (q *Queries) DropPrompts(ctx context.Context) error

func (*Queries) ListPromptsBySessID

func (q *Queries) ListPromptsBySessID(ctx context.Context, sessionID string) (Prompt, error)

func (*Queries) WithTx

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

Jump to

Keyboard shortcuts

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