datasource

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abbr

func Abbr(s string, maxWidth int) string

func CollectionToMap

func CollectionToMap[T Namer](collection []T) map[string]T

func CreateClientForType

func CreateClientForType(t database.Type) (database.Database, error)

func CreateNoSQLClient

func CreateNoSQLClient(modelType database.NoSQLModelType) (database.NoSQL, error)

func CreateSQLClient

func CreateSQLClient(dialect database.SQLDialectType) (database.SQL, error)

func FirstN

func FirstN(s string, n int) string

func LastN

func LastN(s string, n int) string

Types

type Database

type Database struct {
	Name        string
	Description string

	Engine *Engine

	Tables     []*Table
	Views      []*View
	Procedures []*Function
	Roles      []*Role

	Properties struct {
		CharacterSet string
		Collation    string
		Locale       string

		ConnectionLimit int
		Owner           string

		DefaultStorageEngine string
		DefaultSchema        string
		DefaultNamespace     string

		SecurityModel                 string
		RecoveryModel, BackupStrategy string
	}
}

func (*Database) GetName

func (d *Database) GetName() string

type Databases

type Databases []*Database

func (Databases) AsMap

func (d Databases) AsMap() map[string]*Database

type Engine

type Engine struct {
	Name             string
	BuiltinFunctions []*Function

	Properties struct {
		Version string

		TransactionSupport   []string
		ConcurrencyControl   string
		RecoveryModel        string
		StorageModel         string
		IntegrityEnforcement string

		ReplicationCapabilities []string
		IndexingCapabilities    []string
		Caching                 []string
	}
}

type Engines

type Engines []*Engine

type Field

type Field struct {
	Name        string
	Description string

	Properties struct {
		PrimaryKey bool

		Type      string
		Length    *int
		Precision *int
		Scale     *int

		Default   *string
		AutoInc   *string // Auto increment seed, nil if AutoIncrement false
		Virtual   bool
		Generated *string

		Unique        bool
		Index         bool
		Nullable      bool
		AllowedValues []string // name? for enum or set (MySQL)
		Encrypted     bool
		Overrides     struct {
			CharacterSet string
			Collation    string
		}
	}
}

func (*Field) GetName

func (f *Field) GetName() string

type Fields

type Fields []*Field

func (Fields) AsMap

func (f Fields) AsMap() map[string]*Field

type Function

type Function struct {
	Name        string
	Description string

	Properties struct {
		Definition string
		Type       string
		Returns    *string
		Parameters []struct {
			Name        string
			Description string
			Type        string
			Direction   string // IN, OUT, INOUT
		}
	}
}

func (*Function) GetName

func (f *Function) GetName() string

type Functions

type Functions []*Function

func (Functions) AsMap

func (f Functions) AsMap() map[string]*Function

type Namer

type Namer interface {
	GetName() string
}

type Role

type Role struct {
	Name        string
	Description string

	Permissions []string
	Inheritance []string
	Members     []string
}

func (*Role) GetName

func (r *Role) GetName() string

type Roles

type Roles []*Role

func (Roles) AsMap

func (r Roles) AsMap() map[string]*Role

type Server

type Server struct {
	Name string

	Engine    *Engine
	Databases Databases

	MaxConnections int
	Timeout        int
	SecurityModel  string
}

func (*Server) DatabaseMap

func (s *Server) DatabaseMap() map[string]*Database

func (*Server) GetName

func (s *Server) GetName() string

type Servers

type Servers []*Server

type Table

type Table struct {
	Name        string
	Description string

	Engine *Engine

	Fields []*Field

	Properties struct {
		PrimaryKeys []string

		Indexes []struct {
			Name        string
			Description string

			Fields    []string
			Type      string // B-tree, Hash, etc.
			Unique    bool
			Clustered bool
			Spatial   bool
		}
		ForeignKeys []struct {
			Name  string
			Field *Field

			ToTable string
			ToField string

			OnUpdate string
			OnDelete string
		}

		Partitioned bool
	}
}

func (*Table) GetName

func (t *Table) GetName() string

type Tables

type Tables []*Table

func (Tables) AsMap

func (t Tables) AsMap() map[string]*Table

type View

type View struct {
	Name        string
	Description string

	Fields []*Field

	Properties struct {
		Definition   string
		Updatable    bool
		WithCheck    bool
		Materialized bool
	}
}

func (*View) GetName

func (v *View) GetName() string

type Views

type Views []*View

func (Views) AsMap

func (v Views) AsMap() map[string]*View

Directories

Path Synopsis
sql

Jump to

Keyboard shortcuts

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