database

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package database provides low-level database connectivity and helpers used by the DAO layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFunctionName added in v1.5.0

func GetFunctionName(temp interface{}) string

Types

type DB

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

func Connect

func Connect(options ...Option) *DB

func ConnectToNamedDB

func ConnectToNamedDB(name string, options ...Option) *DB

DEPRECATED: ConnectToNamedDB - Use Connect with WithNameSpace option instead

func (*DB) Backup

func (db *DB) Backup(loc string)

func (*DB) Count

func (db *DB) Count(data any) (int, error)

func (*DB) CountWhere

func (db *DB) CountWhere(fieldName dao.Field, value any, to any) (int, error)

func (*DB) Create

func (db *DB) Create(data any) error

func (*DB) Delete

func (db *DB) Delete(data any) error

func (*DB) Disconnect

func (db *DB) Disconnect()

func (*DB) Drop

func (db *DB) Drop(data any) error

func (*DB) GetAll

func (db *DB) GetAll(to any, options ...func(*index.Options)) error

func (*DB) PreLoadCache added in v1.5.0

func (db *DB) PreLoadCache(to any, options ...func(*index.Options)) error

func (*DB) Reconnect added in v1.2.30

func (db *DB) Reconnect()

func (*DB) Retrieve

func (db *DB) Retrieve(fieldName Field, value, to any) error

func (*DB) Update

func (db *DB) Update(data any) error

type Field added in v1.4.1

type Field dao.Field

type Option added in v1.5.0

type Option func(*connectionConfig)

Option is a function that configures the database connection

func WithCacheKey added in v1.5.0

func WithCacheKey(field dao.Field) Option

WithCacheKey sets the cache key field for the database connection

func WithCaching added in v1.5.0

func WithCaching(enabled bool) Option

WithCaching enables or disables caching for the database connection

func WithEncryption added in v1.5.0

func WithEncryption(enabled bool) Option

WithEncryption enables or disables encryption for the database connection By default, encryption is disabled. Reserved for Future use.

func WithIndex added in v1.5.0

func WithIndex(field Field) Option

WithIndex adds a single index field for the database connection Used to create an index on a field for faster querying. Reserved for Future use.

func WithIndices added in v1.5.0

func WithIndices(indices []Field) Option

WithIndices sets the indices for the database connection Used to create indices on fields for faster querying. Reserved for Future use.

func WithNameSpace added in v1.5.0

func WithNameSpace(name string) Option

WithNameSpace sets the namespace (database name) for the connection

func WithPoolSize added in v1.5.0

func WithPoolSize(size int) Option

WithPoolSize sets the maximum connection pool size

func WithTimeout added in v1.5.0

func WithTimeout(seconds int) Option

WithTimeout sets the connection timeout in seconds

func WithVerbose added in v1.5.0

func WithVerbose(enabled bool) Option

WithVerbose enables or disables verbose logging for the database connection

Jump to

Keyboard shortcuts

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