dbkit_tests

package
v0.0.0-...-9e9b37c Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch interface {
	String() string
	Execute(ctx context.Context) error

	InsertBlobTTL(ttl int64, id []byte, _type int32, data []byte)

	InsertBlob(id []byte, _type int32, data []byte)
	DeleteBlobByID(id []byte)
	DeleteBlobByIDAndType(id []byte, _type int32)
	SaveBlob(blob *Blob)
}

type Blob

type Blob struct {
	ID   []byte
	Type int32
	Data []byte
	// contains filtered or unexported fields
}

Blob represents a row in the Blobs table

func (*Blob) Save

func (i *Blob) Save(ctx context.Context) error

Save saves any changes to the row

type BlobQuery

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

BlobQuery is a modifiable query against the Blobs table

func (*BlobQuery) Each

func (q *BlobQuery) Each(ctx context.Context, reuseItem bool, action func(*Blob) error) error

Each returns a slice with all the matched item (warning: can use lots of memory)

func (*BlobQuery) First

func (q *BlobQuery) First(ctx context.Context) (*Blob, error)

First returns the first item found by the query

func (*BlobQuery) Limit

func (q *BlobQuery) Limit(limit int) *BlobQuery

Limit changes the limit of the BlobQuery query to the given value

func (*BlobQuery) Slice

func (q *BlobQuery) Slice(ctx context.Context, expectedSliceSize int) ([]*Blob, error)

Slice returns a slice with all the matched item (warning: can use lots of memory)

func (*BlobQuery) SortAscendingBy

func (q *BlobQuery) SortAscendingBy(column string) *BlobQuery

SortAscendingBy adds an ascending sort column to the query

func (*BlobQuery) SortDescendingBy

func (q *BlobQuery) SortDescendingBy(column string) *BlobQuery

SortDescendingBy adds an descending sort column to the query

func (*BlobQuery) Where

func (q *BlobQuery) Where(where string, args ...interface{}) *BlobQuery

Where changes the where clause of the query

type BlobsTable

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

BlobsTable is generated by dbkit

func (BlobsTable) Delete

func (t BlobsTable) Delete(ctx context.Context, query string, args ...interface{}) error

Delete deletes records from the Blobs table based on the given query

func (BlobsTable) DeleteByID

func (t BlobsTable) DeleteByID(ctx context.Context, id []byte) error

DeleteByID deletes records the Blobs table based on the given values

func (BlobsTable) DeleteByIDAndType

func (t BlobsTable) DeleteByIDAndType(ctx context.Context, id []byte, _type int32) error

DeleteByIDAndType deletes records the Blobs table based on the given values

func (BlobsTable) FindByID

func (t BlobsTable) FindByID(id []byte) *BlobQuery

FindByID finds records the Blobs table based on the given values

func (BlobsTable) FindByIDAndType

func (t BlobsTable) FindByIDAndType(id []byte, _type int32) *BlobQuery

FindByIDAndType finds records the Blobs table based on the given values

func (BlobsTable) Insert

func (t BlobsTable) Insert(ctx context.Context, id []byte, _type int32, data []byte) (*Blob, error)

Insert creates a record in the Blobs table

func (BlobsTable) InsertTTL

func (t BlobsTable) InsertTTL(ctx context.Context, ttl int64, id []byte, _type int32, data []byte) (*Blob, error)

InsertTTL creates a record in the Cassandra Blobs table with the given TTL value

func (BlobsTable) Load

func (t BlobsTable) Load(ctx context.Context, query string, args ...interface{}) (*Blob, error)

Load a single record from the Blobs table based on the given query

func (BlobsTable) LoadByID

func (t BlobsTable) LoadByID(ctx context.Context, id []byte) (*Blob, error)

LoadByID loads a single record from the Blobs table based on the given values

func (BlobsTable) LoadByIDAndType

func (t BlobsTable) LoadByIDAndType(ctx context.Context, id []byte, _type int32) (*Blob, error)

LoadByIDAndType loads a single record from the Blobs table based on the given values

func (BlobsTable) Query

func (t BlobsTable) Query() *BlobQuery

Query creates a query for records in the Blobs table by id

type DB

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

DB is the main access point to the database

func NewDB

func NewDB(driverName, dataSourceName string) (*DB, error)

NewDB creates a new DB pointer to access a database

func (*DB) NewBatch

func (db *DB) NewBatch() Batch

func (*DB) NewLoader

func (db *DB) NewLoader() *Loader

type Loader

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

Loader makes it easy to load multiple values from multiple tables in one go

func (*Loader) AddBlob

func (l *Loader) AddBlob(blob *Blob)

func (*Loader) GetBlob

func (l *Loader) GetBlob(id []byte, _type int32) *Blob

func (*Loader) Load

func (l *Loader) Load(ctx context.Context) error

func (*Loader) MarkBlobForLoad

func (l *Loader) MarkBlobForLoad(id []byte, _type int32)

Jump to

Keyboard shortcuts

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