storage

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigFs embed.FS
View Source
var ErrNotFound = errors.New("the requested resource was not found")

Functions

This section is empty.

Types

type CosmosDBAdapter added in v0.11.0

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

func GetCosmosDBAdapterInstance added in v0.11.0

func GetCosmosDBAdapterInstance(config map[string]string) *CosmosDBAdapter

func (*CosmosDBAdapter) Count added in v0.11.0

func (s *CosmosDBAdapter) Count(dest any, filter map[string]any, params ...map[string]any) (int64, error)

func (*CosmosDBAdapter) Create added in v0.11.0

func (s *CosmosDBAdapter) Create(item any, params ...map[string]any) error

func (*CosmosDBAdapter) CreateMigrationTable added in v0.11.0

func (s *CosmosDBAdapter) CreateMigrationTable() error

func (*CosmosDBAdapter) CreateSchema added in v0.11.0

func (s *CosmosDBAdapter) CreateSchema() error

func (*CosmosDBAdapter) Delete added in v0.11.0

func (s *CosmosDBAdapter) Delete(item any, filter map[string]any, params ...map[string]any) error

func (*CosmosDBAdapter) Execute added in v0.11.0

func (s *CosmosDBAdapter) Execute(statement string) error

func (*CosmosDBAdapter) Get added in v0.11.0

func (s *CosmosDBAdapter) Get(dest any, filter map[string]any, params ...map[string]any) error

func (*CosmosDBAdapter) GetLatestMigration added in v0.11.0

func (s *CosmosDBAdapter) GetLatestMigration() (int, error)

func (*CosmosDBAdapter) GetProvider added in v0.11.0

func (s *CosmosDBAdapter) GetProvider() StorageProviders

func (*CosmosDBAdapter) GetSchemaName added in v0.11.0

func (s *CosmosDBAdapter) GetSchemaName() string

func (*CosmosDBAdapter) GetType added in v0.11.0

func (s *CosmosDBAdapter) GetType() StorageAdapterType

func (*CosmosDBAdapter) List added in v0.11.0

func (s *CosmosDBAdapter) List(dest any, sortKey string, filter map[string]any, limit int, cursor string, params ...map[string]any) (string, error)

func (*CosmosDBAdapter) OpenConnection added in v0.11.0

func (s *CosmosDBAdapter) OpenConnection()

func (*CosmosDBAdapter) Ping added in v0.11.0

func (s *CosmosDBAdapter) Ping() error

func (*CosmosDBAdapter) Query added in v0.11.0

func (s *CosmosDBAdapter) Query(dest any, statement string, limit int, cursor string, params ...map[string]any) (string, error)

func (*CosmosDBAdapter) Search added in v0.11.0

func (s *CosmosDBAdapter) Search(dest any, sortKey string, query string, limit int, cursor string, params ...map[string]any) (string, error)

func (*CosmosDBAdapter) Update added in v0.11.0

func (s *CosmosDBAdapter) Update(item any, filter map[string]any, params ...map[string]any) error

func (*CosmosDBAdapter) UpdateMigrationTable added in v0.11.0

func (s *CosmosDBAdapter) UpdateMigrationTable(id int, name string, desc string) error

type DatabaseMigration

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

func NewDatabaseMigration

func NewDatabaseMigration(storageAdapter StorageAdapter) *DatabaseMigration

func (*DatabaseMigration) Migrate

func (m *DatabaseMigration) Migrate()

type DynamoDBAdapter

type DynamoDBAdapter struct {
	DB *dynamodb.Client
	// contains filtered or unexported fields
}

func GetDynamoDBAdapterInstance

func GetDynamoDBAdapterInstance(config map[string]string) *DynamoDBAdapter

func (*DynamoDBAdapter) Count added in v0.6.0

func (s *DynamoDBAdapter) Count(dest any, filter map[string]any, params ...map[string]any) (int64, error)

func (*DynamoDBAdapter) Create

func (s *DynamoDBAdapter) Create(item any, params ...map[string]any) error

func (*DynamoDBAdapter) CreateMigrationTable added in v0.9.1

func (s *DynamoDBAdapter) CreateMigrationTable() error

func (*DynamoDBAdapter) CreateSchema added in v0.9.1

func (s *DynamoDBAdapter) CreateSchema() error

func (*DynamoDBAdapter) Delete

func (s *DynamoDBAdapter) Delete(item any, filter map[string]any, params ...map[string]any) error

func (*DynamoDBAdapter) Execute

func (s *DynamoDBAdapter) Execute(statement string) error

func (*DynamoDBAdapter) Get

func (s *DynamoDBAdapter) Get(dest any, filter map[string]any, params ...map[string]any) error

func (*DynamoDBAdapter) GetLatestMigration added in v0.9.1

func (s *DynamoDBAdapter) GetLatestMigration() (int, error)

func (*DynamoDBAdapter) GetProvider added in v0.3.0

func (s *DynamoDBAdapter) GetProvider() StorageProviders

func (*DynamoDBAdapter) GetSchemaName added in v0.3.0

func (s *DynamoDBAdapter) GetSchemaName() string

func (*DynamoDBAdapter) GetType added in v0.3.0

func (s *DynamoDBAdapter) GetType() StorageAdapterType

func (*DynamoDBAdapter) List

func (s *DynamoDBAdapter) List(dest any, sortKey string, filter map[string]any, limit int, cursor string, params ...map[string]any) (string, error)

func (*DynamoDBAdapter) OpenConnection

func (s *DynamoDBAdapter) OpenConnection()

func (*DynamoDBAdapter) Ping

func (s *DynamoDBAdapter) Ping() error

func (*DynamoDBAdapter) Query added in v0.7.0

func (s *DynamoDBAdapter) Query(dest any, statement string, limit int, cursor string, params ...map[string]any) (string, error)

func (*DynamoDBAdapter) Search added in v0.6.0

func (s *DynamoDBAdapter) Search(dest any, sortKey string, query string, limit int, cursor string, params ...map[string]any) (string, error)

func (*DynamoDBAdapter) Update

func (s *DynamoDBAdapter) Update(item any, filter map[string]any, params ...map[string]any) error

func (*DynamoDBAdapter) UpdateMigrationTable added in v0.9.1

func (s *DynamoDBAdapter) UpdateMigrationTable(id int, name string, desc string) error

type MemoryAdapter

type MemoryAdapter struct {
	DB *SQLAdapter
}

func GetMemoryAdapterInstance

func GetMemoryAdapterInstance() *MemoryAdapter

func (*MemoryAdapter) Count added in v0.6.0

func (m *MemoryAdapter) Count(dest any, filter map[string]any, params ...map[string]any) (int64, error)

func (*MemoryAdapter) Create

func (m *MemoryAdapter) Create(item any, params ...map[string]any) error

func (*MemoryAdapter) CreateMigrationTable added in v0.9.1

func (m *MemoryAdapter) CreateMigrationTable() error

func (*MemoryAdapter) CreateSchema added in v0.9.1

func (m *MemoryAdapter) CreateSchema() error

func (*MemoryAdapter) Delete

func (m *MemoryAdapter) Delete(item any, filter map[string]any, params ...map[string]any) error

func (*MemoryAdapter) Execute

func (m *MemoryAdapter) Execute(s string) error

func (*MemoryAdapter) Get

func (m *MemoryAdapter) Get(dest any, filter map[string]any, params ...map[string]any) error

func (*MemoryAdapter) GetLatestMigration added in v0.9.1

func (m *MemoryAdapter) GetLatestMigration() (int, error)

func (*MemoryAdapter) GetProvider added in v0.3.0

func (m *MemoryAdapter) GetProvider() StorageProviders

func (*MemoryAdapter) GetSchemaName added in v0.3.0

func (m *MemoryAdapter) GetSchemaName() string

func (*MemoryAdapter) GetType added in v0.3.0

func (m *MemoryAdapter) GetType() StorageAdapterType

func (*MemoryAdapter) List

func (m *MemoryAdapter) List(dest any, sortKey string, filter map[string]any, limit int, cursor string, params ...map[string]any) (string, error)

func (*MemoryAdapter) Ping

func (m *MemoryAdapter) Ping() error

func (*MemoryAdapter) Query added in v0.7.0

func (m *MemoryAdapter) Query(dest any, statement string, limit int, cursor string, params ...map[string]any) (string, error)

func (*MemoryAdapter) Search added in v0.6.0

func (m *MemoryAdapter) Search(dest any, sortKey string, query string, limit int, cursor string, params ...map[string]any) (string, error)

func (*MemoryAdapter) Update

func (m *MemoryAdapter) Update(item any, filter map[string]any, params ...map[string]any) error

func (*MemoryAdapter) UpdateMigrationTable added in v0.9.1

func (m *MemoryAdapter) UpdateMigrationTable(id int, name string, desc string) error

type Migration

type Migration struct {
	Migrate  string
	Rollback string
}

type MigrationFile

type MigrationFile struct {
	Description string
	Migrations  []Migration
}

type SQLAdapter

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

func GetSQLAdapterInstance

func GetSQLAdapterInstance(config map[string]string) *SQLAdapter

func (*SQLAdapter) Count added in v0.6.0

func (s *SQLAdapter) Count(dest any, filter map[string]any, params ...map[string]any) (int64, error)

func (*SQLAdapter) Create

func (s *SQLAdapter) Create(item any, params ...map[string]any) error

func (*SQLAdapter) CreateMigrationTable added in v0.9.1

func (s *SQLAdapter) CreateMigrationTable() error

func (*SQLAdapter) CreateSchema added in v0.9.1

func (s *SQLAdapter) CreateSchema() error

func (*SQLAdapter) Delete

func (s *SQLAdapter) Delete(item any, filter map[string]any, params ...map[string]any) error

func (*SQLAdapter) Execute

func (s *SQLAdapter) Execute(statement string) error

func (*SQLAdapter) Get

func (s *SQLAdapter) Get(dest any, filter map[string]any, params ...map[string]any) error

func (*SQLAdapter) GetLatestMigration added in v0.9.1

func (s *SQLAdapter) GetLatestMigration() (int, error)

func (*SQLAdapter) GetProvider added in v0.3.0

func (s *SQLAdapter) GetProvider() StorageProviders

func (*SQLAdapter) GetSchemaName added in v0.3.0

func (s *SQLAdapter) GetSchemaName() string

func (*SQLAdapter) GetType added in v0.3.0

func (s *SQLAdapter) GetType() StorageAdapterType

func (*SQLAdapter) List

func (s *SQLAdapter) List(dest any, sortKey string, filter map[string]any, limit int, cursor string, params ...map[string]any) (string, error)

func (*SQLAdapter) OpenConnection

func (s *SQLAdapter) OpenConnection()

func (*SQLAdapter) Ping

func (s *SQLAdapter) Ping() error

func (*SQLAdapter) Query added in v0.7.0

func (s *SQLAdapter) Query(dest any, statement string, limit int, cursor string, params ...map[string]any) (string, error)

func (*SQLAdapter) Search added in v0.6.0

func (s *SQLAdapter) Search(dest any, sortKey string, query string, limit int, cursor string, params ...map[string]any) (string, error)

func (*SQLAdapter) Update

func (s *SQLAdapter) Update(item any, filter map[string]any, params ...map[string]any) error

func (*SQLAdapter) UpdateMigrationTable added in v0.9.1

func (s *SQLAdapter) UpdateMigrationTable(id int, name string, desc string) error

type StorageAdapter

type StorageAdapter interface {
	Execute(statement string) error
	Ping() error
	GetType() StorageAdapterType
	GetProvider() StorageProviders
	GetSchemaName() string
	CreateSchema() error
	CreateMigrationTable() error
	UpdateMigrationTable(id int, name string, desc string) error
	GetLatestMigration() (int, error)
	Create(item any, params ...map[string]any) error
	Get(dest any, filter map[string]any, params ...map[string]any) error
	Update(item any, filter map[string]any, params ...map[string]any) error
	Delete(item any, filter map[string]any, params ...map[string]any) error
	List(dest any, sortKey string, filter map[string]any, limit int, cursor string, params ...map[string]any) (string, error)
	Search(dest any, sortKey string, query string, limit int, cursor string, params ...map[string]any) (string, error)
	Count(dest any, filter map[string]any, params ...map[string]any) (int64, error)
	Query(dest any, statement string, limit int, cursor string, params ...map[string]any) (string, error)
}

type StorageAdapterFactory

type StorageAdapterFactory struct{}

func (StorageAdapterFactory) GetInstance

func (s StorageAdapterFactory) GetInstance(adapterType StorageAdapterType, config any) (StorageAdapter, error)

type StorageAdapterType

type StorageAdapterType string
const (
	// CASSANDRA StorageAdapterType = "cassandra"
	COSMOSDB StorageAdapterType = "cosmosdb"
	DYNAMODB StorageAdapterType = "dynamodb"
	MEMORY   StorageAdapterType = "memory"
	SQL      StorageAdapterType = "sql"
)

type StorageProviders

type StorageProviders string
const (
	POSTGRESQL        StorageProviders = "postgresql"
	MYSQL             StorageProviders = "mysql"
	SQLITE            StorageProviders = "sqlite"
	COSMOSDB_PROVIDER StorageProviders = "cosmosdb"
)

Directories

Path Synopsis
search

Jump to

Keyboard shortcuts

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