db

package
v0.0.0-...-23a443e Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Instance *doltswarm.DB

Functions

func Delete

func Delete(db *DB, mappers ...DeleteMapper) error

func Insert

func Insert(db *DB, mappers ...InsertMapper) error

Insert inserts a new entry in the database using the sq query builder

func SelectMultiple

func SelectMultiple[T any](db *DB, mc QueryMapper[T]) ([]T, error)

func SelectOne

func SelectOne[T any](db *DB, mc QueryMapper[T]) (T, error)

func Update

func Update(db *DB, mappers ...UpdateMapper) error

Types

type APP

type APP struct {
	sq.TableStruct `sq:"apps"`
	ID             sq.StringField  `ddl:"notnull primarykey"`
	NAME           sq.StringField  `ddl:"notnull index"`
	INSTALLER_REF  sq.StringField  `ddl:"notnull"`
	INSTANCE_ID    sq.StringField  `ddl:"notnull"`
	DESIRED_STATUS sq.StringField  `ddl:"notnull"`
	PERSISTENCE    sq.BooleanField `ddl:"notnull"`
	PUBLIC_KEY     sq.StringField  `ddl:"notnull index"`
}

type CLOUD_MACHINE_METADATA

type CLOUD_MACHINE_METADATA struct {
	sq.TableStruct `sq:"cloud_machines_metadata"`
	ID             sq.StringField `ddl:"notnull primarykey"`
	CLOUD_ID       sq.StringField `ddl:"notnull"`
	PUBLIC_IP      sq.StringField `ddl:"notnull"`
	LOCATION       sq.StringField `ddl:"notnull"`
	ARCHITECTURE   sq.StringField `ddl:"notnull"`
	PUBLIC_KEY     sq.StringField `ddl:"notnull index"`
}

type CLOUD_PROVIDER

type CLOUD_PROVIDER struct {
	sq.TableStruct `sq:"cloud_providers"`
	ID             sq.StringField `ddl:"notnull primarykey"`
	NAME           sq.StringField `ddl:"notnull index"`
	TYPE           sq.StringField `ddl:"notnull"`
	AUTH           sq.JSONField   `ddl:"notnull"`
}

type DB

type DB struct {
	*doltswarm.DB
	// contains filtered or unexported fields
}

func Open

func Open(workDir string, dbName string, signer doltswarm.Signer) (*DB, error)

func (*DB) Init

func (db *DB) Init() error

func (*DB) RegisterNotifier

func (db *DB) RegisterNotifier(model any, notifier Notifier) error

type DeleteMapper

type DeleteMapper func() sq.DeleteQuery

type InsertMapper

type InsertMapper func() sq.InsertQuery

type MACHINE

type MACHINE struct {
	sq.TableStruct `sq:"machines"`
	ID             sq.StringField `ddl:"notnull primarykey"`
	NAME           sq.StringField `ddl:"notnull index"`
	KIND           sq.StringField `ddl:"notnull"`
}

type Notifier

type Notifier doltswarm.Notifier

type QueryMapper

type QueryMapper[T any] func() (sq.SelectQuery, func(row *sq.Row) T)

type USER

type USER struct {
	sq.TableStruct `sq:"users"`
	USERNAME       sq.StringField `ddl:"notnull primarykey"`
	NAME           sq.StringField
	IS_DISABLED    sq.BooleanField `ddl:"notnull"`
}

type USER_DEVICE_METADATA

type USER_DEVICE_METADATA struct {
	sq.TableStruct `sq:"user_devices_metadata"`
	ID             sq.StringField `ddl:"notnull primarykey"`
	PUBLIC_KEY     sq.StringField `ddl:"notnull index"`
	USER_ID        sq.StringField `ddl:"notnull index"`
	NAME           sq.StringField `ddl:"notnull"`
}

type UpdateMapper

type UpdateMapper func() sq.UpdateQuery

Jump to

Keyboard shortcuts

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