sqlite

package
v0.0.0-...-dd36d75 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MemoryDSN is the in-memory data source name.
	MemoryDSN = "sqlite://:memory:"
	// Migrations is the file path glob for migrations.
	Migrations = "schema/*.sql"
	// Scehem is required sqlite scheme
	Scheme = "sqlite"
	// DefaultLabel is memory graph default label.
	DefaultLabel = "SqliteGraph"
)

Variables

This section is empty.

Functions

func AttrsFromString

func AttrsFromString(attrString string) (map[string]interface{}, error)

Types

type DB

type DB struct {

	// Datasource name.
	DSN string
	// contains filtered or unexported fields
}

func NewDB

func NewDB(dsn string) (*DB, error)

NewDB returns a new instance of DB associated with the given datasource name.

func (*DB) Close

func (s *DB) Close() error

Close closes the database connection.

type Loader

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

Loader loads graph from sqlite DB.

func NewLoader

func NewLoader(db *DB) (*Loader, error)

NewLoader creates a new loader and returns it.

func (*Loader) Load

func (l *Loader) Load(ctx context.Context, uid string) (graph.Graph, error)

Load loads the graph from sqlite DB and returns it.

type NullTime

type NullTime time.Time

NullTime represents a helper wrapper for time.Time. It automatically converts time fields to/from RFC 3339 format. Also supports NULL for zero time.

func (*NullTime) Scan

func (n *NullTime) Scan(value interface{}) error

Scan reads a time value from the database.

func (*NullTime) Value

func (n *NullTime) Value() (driver.Value, error)

Value formats a time value for the database.

type Syncer

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

Syncer syncs graph to sqlite.

func NewSyncer

func NewSyncer(db *DB) (*Syncer, error)

NewSyncer creates a new sqlite syncer and returns it.

func (*Syncer) Sync

func (s *Syncer) Sync(ctx context.Context, g graph.Graph) error

Sync sync graph g to sqlite DB.

Jump to

Keyboard shortcuts

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