database

package
v0.0.0-...-0fdad5e Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SQLite3
	SQLTypeSqlite3ID      = "INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT"
	SQLTypeSqlite3Text    = "TEXT"
	SQLTypeSqlite3Boolean = "INTEGER"
	SQLTypeSqlite3Integer = "INTEGER"
	SQLTypeSqlite3Blob    = "BLOB"
	// PostgreSQL
	SQLTypePostgresID      = "BIGSERIAL NOT NULL PRIMARY KEY"
	SQLTypePostgresUUID    = "CHARACTER(36)"
	SQLTypePostgresText    = "TEXT"
	SQLTypePostgresBoolean = "BOOLEAN"
	SQLTypePostgresBigInt  = "BIGINT"
	SQLTypePostgresJsonb   = "JSONB"
	// All
	SQLTypeReference = "REFERENCE"
)
View Source
const (
	DatabaseTypeSqlite3  = DatabaseType("sqlite3")
	DatabaseTypePostgres = DatabaseType("postgres")
)

Variables

View Source
var (
	ErrorUnknownDatabaseType = errors.New("unknown database type")
)

Functions

This section is empty.

Types

type DB

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

func NewSqlite3Instance

func NewSqlite3Instance(databasePath string) (*DB, error)

func (*DB) CreateItem

func (db *DB) CreateItem(collection *blueprint.Collection, item blueprint.Item) error

func (*DB) CreateReferenceTable

func (db *DB) CreateReferenceTable(collection1 *blueprint.Collection, collection2 *blueprint.Collection) error

func (*DB) CreateTable

func (db *DB) CreateTable(collection *blueprint.Collection, collectionLoader *blueprint.CollectionLoader) error

func (*DB) CreateTables

func (db *DB) CreateTables(collections []blueprint.Collection, collectionLoader *blueprint.CollectionLoader) error

func (*DB) GetItem

func (db *DB) GetItem(collection *blueprint.Collection, id string) (blueprint.Item, error)

func (*DB) GetItems

func (db *DB) GetItems(collection *blueprint.Collection, limit int, offset int64) ([]blueprint.Item, error)

func (*DB) UpdateItem

func (db *DB) UpdateItem(collection *blueprint.Collection, item blueprint.Item) error

type DatabaseType

type DatabaseType string

type SQLType

type SQLType string

Jump to

Keyboard shortcuts

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