engine

package
v0.0.0-...-74e806d Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DatabaseType_Postgres      = "Postgres"
	DatabaseType_MySQL         = "MySQL"
	DatabaseType_MariaDB       = "MariaDB"
	DatabaseType_Sqlite3       = "Sqlite3"
	DatabaseType_MongoDB       = "MongoDB"
	DatabaseType_Redis         = "Redis"
	DatabaseType_ElasticSearch = "ElasticSearch"
)
View Source
const (
	GraphUnitRelationshipType_OneToOne   = "OneToOne"
	GraphUnitRelationshipType_OneToMany  = "OneToMany"
	GraphUnitRelationshipType_ManyToOne  = "ManyToOne"
	GraphUnitRelationshipType_ManyToMany = "ManyToMany"
	GraphUnitRelationshipType_Unknown    = "Unknown"
)

Variables

This section is empty.

Functions

func GetStorageUnitModel

func GetStorageUnitModel(unit StorageUnit) *model.StorageUnit

Types

type ChatMessage

type ChatMessage struct {
	Type   string
	Result *GetRowsResult
	Text   string
}

type Column

type Column struct {
	Type string
	Name string
}

type Credentials

type Credentials struct {
	Id          *string
	Type        string
	Hostname    string
	Username    string
	Password    string
	Database    string
	Advanced    []Record
	AccessToken *string
}

type DatabaseType

type DatabaseType string

type Engine

type Engine struct {
	Plugins []*Plugin
}

func (*Engine) Choose

func (e *Engine) Choose(databaseType DatabaseType) *Plugin

func (*Engine) RegistryPlugin

func (e *Engine) RegistryPlugin(plugin *Plugin)

type ExternalModel

type ExternalModel struct {
	Type  string
	Token string
}

type GetRowsResult

type GetRowsResult struct {
	Columns       []Column
	Rows          [][]string
	DisableUpdate bool
}

type GraphUnit

type GraphUnit struct {
	Unit      StorageUnit
	Relations []GraphUnitRelationship
}

type GraphUnitRelationship

type GraphUnitRelationship struct {
	Name             string
	RelationshipType GraphUnitRelationshipType
}

type GraphUnitRelationshipType

type GraphUnitRelationshipType string

type Plugin

type Plugin struct {
	PluginFunctions
	Type DatabaseType
}

type PluginConfig

type PluginConfig struct {
	Credentials   *Credentials
	ExternalModel *ExternalModel
}

func NewPluginConfig

func NewPluginConfig(credentials *Credentials) *PluginConfig

type PluginFunctions

type PluginFunctions interface {
	GetDatabases(config *PluginConfig) ([]string, error)
	IsAvailable(config *PluginConfig) bool
	GetSchema(config *PluginConfig) ([]string, error)
	GetStorageUnits(config *PluginConfig, schema string) ([]StorageUnit, error)
	AddStorageUnit(config *PluginConfig, schema string, storageUnit string, fields map[string]string) (bool, error)
	UpdateStorageUnit(config *PluginConfig, schema string, storageUnit string, values map[string]string) (bool, error)
	AddRow(config *PluginConfig, schema string, storageUnit string, values []Record) (bool, error)
	DeleteRow(config *PluginConfig, schema string, storageUnit string, values map[string]string) (bool, error)
	GetRows(config *PluginConfig, schema string, storageUnit string, where string, pageSize int, pageOffset int) (*GetRowsResult, error)
	GetGraph(config *PluginConfig, schema string) ([]GraphUnit, error)
	RawExecute(config *PluginConfig, query string) (*GetRowsResult, error)
	Chat(config *PluginConfig, schema string, model string, previousConversation string, query string) ([]*ChatMessage, error)
}

type Record

type Record struct {
	Key   string
	Value string
	Extra map[string]string
}

type StorageUnit

type StorageUnit struct {
	Name       string
	Attributes []Record
}

Jump to

Keyboard shortcuts

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