mysql

package module
v0.0.0-...-1a43f7c Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 12

Documentation

Overview

Package mysql implements a storage interface for Aries (aries-framework-go).

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyRequired = errors.New("key is mandatory")

ErrKeyRequired is returned when key is mandatory.

Functions

This section is empty.

Types

type Option

type Option func(opts *Provider)

Option configures the couchdb provider.

func WithDBPrefix

func WithDBPrefix(dbPrefix string) Option

WithDBPrefix option is for adding prefix to db name.

type Provider

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

Provider represents a MySQL DB implementation of the storage.Provider interface.

func NewProvider

func NewProvider(dbPath string, opts ...Option) (*Provider, error)

NewProvider instantiates Provider. Example DB Path root:my-secret-pw@tcp(127.0.0.1:3306)/?interpolateParams=true&multiStatements=true This provider's CreateStore(name) implementation creates stores that are backed by a table under a schema with the same name as the table. The fully qualified name of the table is thus `name.name`. The fully qualified name of the table needs to be used with the store's `Query()` method. Use of `Batch()` has additional considerations - please read the docs for Batch() accordingly..

func (*Provider) Close

func (p *Provider) Close() error

Close closes all stores created under this store provider.

func (*Provider) GetOpenStores

func (p *Provider) GetOpenStores() []storage.Store

GetOpenStores is currently not implemented.

func (*Provider) GetStoreConfig

func (p *Provider) GetStoreConfig(name string) (storage.StoreConfiguration, error)

GetStoreConfig returns the store's configuration. TODO (#167): Check for underlying database's existence instead of looking at in-memory stores.

func (*Provider) OpenStore

func (p *Provider) OpenStore(name string) (storage.Store, error)

OpenStore opens a store with the given name and returns a handle. If the store has never been opened before, then it is created. Store names are not case-sensitive. If name is blank, then an error will be returned. WARNING: This method will create a database and table based on the given name. Those database calls may be vulnerable to an SQL injection attack. Be very careful if you use a user-provided string in the store name!

func (*Provider) SetStoreConfig

func (p *Provider) SetStoreConfig(name string, config storage.StoreConfiguration) error

SetStoreConfig sets the configuration on a store. This must be done before storing any data in order to make use of the Query method. TODO (#67): Use proper MySQL indexing instead of the "Tag Map".

Jump to

Keyboard shortcuts

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