storage

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 30 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 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) Create

func (s *DynamoDBAdapter) Create(item any) error

func (*DynamoDBAdapter) Delete

func (s *DynamoDBAdapter) Delete(item any, filter 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) 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) (string, error)

func (*DynamoDBAdapter) OpenConnection

func (s *DynamoDBAdapter) OpenConnection()

func (*DynamoDBAdapter) Ping

func (s *DynamoDBAdapter) Ping() error

func (*DynamoDBAdapter) Update

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

type MemoryAdapter

type MemoryAdapter struct {
	DB *SQLAdapter
}

func GetMemoryAdapterInstance

func GetMemoryAdapterInstance() *MemoryAdapter

func (*MemoryAdapter) Create

func (m *MemoryAdapter) Create(item any) error

func (*MemoryAdapter) Delete

func (m *MemoryAdapter) Delete(item any, filter 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) 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) (string, error)

func (*MemoryAdapter) Ping

func (m *MemoryAdapter) Ping() error

func (*MemoryAdapter) Update

func (m *MemoryAdapter) Update(item any, filter map[string]any) 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) Create

func (s *SQLAdapter) Create(item any) error

func (*SQLAdapter) Delete

func (s *SQLAdapter) Delete(item any, filter 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) 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) (string, error)

func (*SQLAdapter) OpenConnection

func (s *SQLAdapter) OpenConnection()

func (*SQLAdapter) Ping

func (s *SQLAdapter) Ping() error

func (*SQLAdapter) Update

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

type StorageAdapter

type StorageAdapter interface {
	Execute(statement string) error
	Ping() error
	GetType() StorageAdapterType
	GetProvider() StorageProviders
	GetSchemaName() string
	Create(item any) error
	Get(dest any, filter map[string]any) error
	Update(item any, filter map[string]any) error
	Delete(item any, filter map[string]any) error
	List(dest any, sortKey string, filter map[string]any, limit int, cursor string) (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 (
	MEMORY   StorageAdapterType = "memory"
	SQL      StorageAdapterType = "sql"
	DYNAMODB StorageAdapterType = "dynamodb"
)

type StorageProviders

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

Jump to

Keyboard shortcuts

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