database

package
v0.0.0-...-cb527ea Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

func Open

func Open(path string, with_options ...Option) (container *Container, err error)

func (*Container) Close

func (container *Container) Close() (err error)

func (*Container) Commit

func (container *Container) Commit(tx *Transaction) error

func (*Container) NewTransaction

func (container *Container) NewTransaction() (tx *Transaction, err error)

func (*Container) Release

func (container *Container) Release(tx *Transaction) error

func (*Container) Table

func (container *Container) Table(table_name string) *Table

func (*Container) TableSchema

func (container *Container) TableSchema(table_name string) (record_struct *storage.TableSchemaStructure)

func (*Container) Tables

func (container *Container) Tables() (tables map[string]int32)

type Option

type Option func(opt *Options) error

func WithEngine

func WithEngine(engine string) Option

type Options

type Options struct {
	Engine string
}

type Table

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

func (*Table) Insert

func (table *Table) Insert(records any) (err error)

Insert structs into the table using Go reflection.

func (*Table) InsertRecords

func (table *Table) InsertRecords(records []storage.Record) error

Insert records into the database after having converted your data to the proper format. This is the reflection-free alternative to (*Table).Insert().

func (*Table) Iterate

func (table *Table) Iterate(fn any) error

func (*Table) Query

func (table *Table) Query(expression *query.Expression) *TableQuery

func (*Table) Schema

func (table *Table) Schema() *storage.TableSchemaStructure

func (*Table) Sync

func (table *Table) Sync(prototype any) error

Sync schematizes a struct type and applies that schema to the underlying table. Warning: may be slow.

func (*Table) SyncSchema

func (table *Table) SyncSchema(schema *storage.TableSchemaStructure) error

func (*Table) SyncType

func (table *Table) SyncType(structure_type reflect.Type) error

func (*Table) Where

func (table *Table) Where(conditions ...query.Condition) *TableQuery

Create a table query where the result is informed by the supplied conditions The conditions are modified to supply the faster index-reference of columns instead of relying on (*query.Condition).ColumnName

type TableQuery

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

func (*TableQuery) Columns

func (table_query *TableQuery) Columns(names ...string) *TableQuery

func (*TableQuery) Count

func (table_query *TableQuery) Count() (records uint64, err error)

func (*TableQuery) Delete

func (table_query *TableQuery) Delete() (deleted uint64, err error)

func (*TableQuery) Find

func (table_query *TableQuery) Find(multiple any) (err error)

Collect multiple records into an array passed by reference

func (*TableQuery) FindRecords

func (table_query *TableQuery) FindRecords() (records []storage.Record, err error)

Collect multiple mapped records

func (*TableQuery) Get

func (table_query *TableQuery) Get(single any) (found bool, err error)

Look up a single record that matches this query

func (*TableQuery) Limit

func (table_query *TableQuery) Limit(limit uint64) *TableQuery

func (*TableQuery) OrderBy

func (table_query *TableQuery) OrderBy(column_name string, descending bool) *TableQuery

Array the results of a query by a certain column in ascending or descending fashion

func (*TableQuery) Update

func (table_query *TableQuery) Update(record any) (affected_rows uint64, err error)

func (*TableQuery) UpdateColumns

func (table_query *TableQuery) UpdateColumns(values ...any) (affected_rows uint64, err error)

func (*TableQuery) UpdateRecord

func (table_query *TableQuery) UpdateRecord(mapped_record storage.Record) (affected_rows uint64, err error)

type Transaction

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

func (*Transaction) Table

func (tx *Transaction) Table(table_name string) *TransactionTable

type TransactionTable

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

Same as Table, just for a transaction instead of a raw query

func (*TransactionTable) Insert

func (tx_table *TransactionTable) Insert(records any) error

func (*TransactionTable) InsertRecords

func (tx_table *TransactionTable) InsertRecords(records []storage.Record) error

func (*TransactionTable) Iterate

func (tx_table *TransactionTable) Iterate(fn any) error

func (*TransactionTable) Schema

func (tx_table *TransactionTable) Schema() *storage.TableSchemaStructure

func (*TransactionTable) Where

func (tx_table *TransactionTable) Where(conditions ...query.Condition) *TransactionTableQuery

type TransactionTableQuery

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

func (*TransactionTableQuery) Columns

func (tx_table_query *TransactionTableQuery) Columns(names ...string) *TransactionTableQuery

func (*TransactionTableQuery) Count

func (tx_table_query *TransactionTableQuery) Count() (records uint64, err error)

func (*TransactionTableQuery) Delete

func (tx_table_query *TransactionTableQuery) Delete() (deleted uint64, err error)

func (*TransactionTableQuery) Find

func (tx_table_query *TransactionTableQuery) Find(multiple any) (err error)

Collect multiple records into an array passed by reference

func (*TransactionTableQuery) Get

func (tx_table_query *TransactionTableQuery) Get(single any) (found bool, err error)

Find a single record matched by the query

func (*TransactionTableQuery) Limit

func (tx_table_query *TransactionTableQuery) Limit(limit uint64) *TransactionTableQuery

func (*TransactionTableQuery) OrderBy

func (tx_table_query *TransactionTableQuery) OrderBy(column_name string, descending bool) *TransactionTableQuery

Array the results of a query by a certain column in ascending or descending fashion

func (*TransactionTableQuery) Update

func (tx_table_query *TransactionTableQuery) Update(record any) (affected_rows uint64, err error)

func (*TransactionTableQuery) UpdateRecord

func (tx_table_query *TransactionTableQuery) UpdateRecord(mapped_record storage.Record) (affected_rows uint64, err error)

Directories

Path Synopsis
engine/leveldb_core
Package leveldb_core implements a storage.Engine using LevelDB
Package leveldb_core implements a storage.Engine using LevelDB

Jump to

Keyboard shortcuts

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