functions

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFkRelations

func GetFkRelations(db *gorm.DB, tn string) ([]struct {
	ColumnName        string `db:"column_name"`
	ForeignTableName  string `db:"foreign_table_name"`
	ForeignColumnName string `db:"foreign_column_name"`
}, error,
)

func GetTables

func GetTables(db *gorm.DB) ([]string, error)

Types

type ChatFunctionDefinition

type ChatFunctionDefinition interface {
	Name() string
	Description() string
	Arguments() map[string]interface{}
	Execute(args map[string]interface{}) (string, error)
}

func NewGetSchema

func NewGetSchema(db *gorm.DB) ChatFunctionDefinition

type ChatTools

type ChatTools struct {
	Definitions []ChatFunctionDefinition
}

func Default

func Default(db *gorm.DB) *ChatTools

func New

func New() *ChatTools

func (*ChatTools) Add

func (c *ChatTools) Add(def ChatFunctionDefinition)

func (*ChatTools) Call

func (c *ChatTools) Call(name string, args string) (string, error)

func (*ChatTools) Funcs

func (c *ChatTools) Funcs() map[string]CompletionFunc

func (*ChatTools) OpenAiTools

func (c *ChatTools) OpenAiTools() []openai.Tool

type Column

type Column struct {
	Type     string   `json:"type"`
	Nullable bool     `json:"nullable"`
	Enums    []string `json:"enums"`
	Ref      *Ref     `json:"ref"`
}

type CompletionFunc

type CompletionFunc func(args map[string]interface{}) (string, error)

type DBColumn

type DBColumn struct {
	ColumnName string `db:"column_name"`
	DataType   string `db:"data_type"`
	UdtName    string `db:"udt_name"`
	IsNullable string `db:"is_nullable"`
}

func GetColumns

func GetColumns(db *gorm.DB, tn string) ([]*DBColumn, error)

type Enum

type Enum struct {
	EnumLabel string `db:"enumlabel"`
	TypName   string `db:"typname"`
}

type Ref

type Ref struct {
	To     string `json:"to"`
	Column string `json:"column"`
}

type Table

type Table struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Columns     map[string]Column `json:"columns"`
}

Jump to

Keyboard shortcuts

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