cloudsqlutil

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name     string
	DataType string
	Nullable bool
}

type EmailRetriever

type EmailRetriever func(ctx context.Context) (string, error)

type InitChatHistoryTableOptions

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

Option type for defining options.

type Option

type Option func(p *engineConfig)

Option is a function type that can be used to modify the Engine.

func WithCloudSQLInstance

func WithCloudSQLInstance(projectID, region, instance string) Option

WithCloudSQLInstance sets the project, region, and instance fields.

func WithDatabase

func WithDatabase(database string) Option

WithDatabase sets the Database field.

func WithIAMAccountEmail

func WithIAMAccountEmail(email string) Option

WithIAMAccountEmail sets the IAMAccountEmail field.

func WithIPType

func WithIPType(ipType string) Option

WithIPType sets the IpType field.

func WithPassword

func WithPassword(password string) Option

WithPassword sets the Password field.

func WithPool

func WithPool(pool *pgxpool.Pool) Option

WithPool sets the Port field.

func WithUser

func WithUser(user string) Option

WithUser sets the User field.

type OptionInitChatHistoryTable

type OptionInitChatHistoryTable func(*InitChatHistoryTableOptions)

Option function type.

func WithSchemaName

func WithSchemaName(schemaName string) OptionInitChatHistoryTable

WithSchemaName sets a custom schema name.

type PostgresEngine

type PostgresEngine struct {
	Pool *pgxpool.Pool
}

func NewPostgresEngine

func NewPostgresEngine(ctx context.Context, opts ...Option) (PostgresEngine, error)

NewPostgresEngine creates a new PostgresEngine.

func (*PostgresEngine) Close

func (p *PostgresEngine) Close()

Close closes the pool connection.

func (*PostgresEngine) InitChatHistoryTable

func (p *PostgresEngine) InitChatHistoryTable(ctx context.Context, tableName string, opts ...OptionInitChatHistoryTable) error

initChatHistoryTable creates a table to store chat history.

func (*PostgresEngine) InitVectorstoreTable

func (p *PostgresEngine) InitVectorstoreTable(ctx context.Context, opts VectorstoreTableOptions) error

initVectorstoreTable creates a table for saving of vectors to be used with PostgresVectorStore.

type VectorstoreTableOptions

type VectorstoreTableOptions struct {
	TableName          string
	VectorSize         int
	SchemaName         string
	ContentColumnName  string
	EmbeddingColumn    string
	MetadataJSONColumn string
	IDColumn           Column
	MetadataColumns    []Column
	OverwriteExisting  bool
	StoreMetadata      bool
}

VectorstoreTableOptions is used with the InitVectorstoreTable to use the required and default fields.

Jump to

Keyboard shortcuts

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