sqlcommon

package
v0.0.0-...-93e01a0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SQLConfMigrationsAuto enables automatic migrations
	SQLConfMigrationsAuto = "migrations.auto"
	// SQLConfMigrationsDirectory is the directory containing the numerically ordered migration DDL files to apply to the database
	SQLConfMigrationsDirectory = "migrations.directory"
	// SQLConfDatasourceURL is the datasource connection URL string
	SQLConfDatasourceURL = "url"
	// SQLConfMaxConnections maximum connections to the database
	SQLConfMaxConnections = "maxConns"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider interface {

	// Name is the name of the database driver
	Name() string

	// MigrationDir is the subdirectory for migrations
	MigrationsDir() string

	// Open creates the DB instances
	Open(url string) (*sql.DB, error)

	// GetDriver returns the driver implementation
	GetMigrationDriver(*sql.DB) (migratedb.Driver, error)

	// PlaceholderFormat gets the Squirrel placeholder format
	PlaceholderFormat() sq.PlaceholderFormat

	// UpdateInsertForReturn updates the insert query for returning the Sequenc, and returns whether it needs to be run as a query to return the Sequence field
	UpdateInsertForSequenceReturn(insert sq.InsertBuilder) (updatedInsert sq.InsertBuilder, runAsQuery bool)
}

Provider defines the interface an individual provider muse implement to customize the SQLCommon implementation

type SQLCommon

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

func (*SQLCommon) Capabilities

func (s *SQLCommon) Capabilities() *database.Capabilities

func (*SQLCommon) Close

func (s *SQLCommon) Close()

func (*SQLCommon) DB

func (s *SQLCommon) DB() *sql.DB

func (*SQLCommon) DeleteBlob

func (s *SQLCommon) DeleteBlob(ctx context.Context, sequence int64) (err error)

func (*SQLCommon) DeleteConfigRecord

func (s *SQLCommon) DeleteConfigRecord(ctx context.Context, key string) (err error)

func (*SQLCommon) DeleteNamespace

func (s *SQLCommon) DeleteNamespace(ctx context.Context, id *fftypes.UUID) (err error)

func (*SQLCommon) DeleteNextPin

func (s *SQLCommon) DeleteNextPin(ctx context.Context, sequence int64) (err error)

func (*SQLCommon) DeleteNonce

func (s *SQLCommon) DeleteNonce(ctx context.Context, context *fftypes.Bytes32) (err error)

func (*SQLCommon) DeleteOffset

func (s *SQLCommon) DeleteOffset(ctx context.Context, t fftypes.OffsetType, name string) (err error)

func (*SQLCommon) DeletePin

func (s *SQLCommon) DeletePin(ctx context.Context, sequence int64) (err error)

func (*SQLCommon) DeleteSubscriptionByID

func (s *SQLCommon) DeleteSubscriptionByID(ctx context.Context, id *fftypes.UUID) (err error)

func (*SQLCommon) GetBatchByID

func (s *SQLCommon) GetBatchByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Batch, err error)

func (*SQLCommon) GetBatches

func (s *SQLCommon) GetBatches(ctx context.Context, filter database.Filter) (message []*fftypes.Batch, res *database.FilterResult, err error)

func (*SQLCommon) GetBlobMatchingHash

func (s *SQLCommon) GetBlobMatchingHash(ctx context.Context, hash *fftypes.Bytes32) (message *fftypes.Blob, err error)

func (*SQLCommon) GetBlobs

func (s *SQLCommon) GetBlobs(ctx context.Context, filter database.Filter) (message []*fftypes.Blob, res *database.FilterResult, err error)

func (*SQLCommon) GetConfigRecord

func (s *SQLCommon) GetConfigRecord(ctx context.Context, key string) (result *fftypes.ConfigRecord, err error)

func (*SQLCommon) GetConfigRecords

func (s *SQLCommon) GetConfigRecords(ctx context.Context, filter database.Filter) (result []*fftypes.ConfigRecord, res *database.FilterResult, err error)

func (*SQLCommon) GetData

func (s *SQLCommon) GetData(ctx context.Context, filter database.Filter) (message []*fftypes.Data, res *database.FilterResult, err error)

func (*SQLCommon) GetDataByID

func (s *SQLCommon) GetDataByID(ctx context.Context, id *fftypes.UUID, withValue bool) (message *fftypes.Data, err error)

func (*SQLCommon) GetDataRefs

func (s *SQLCommon) GetDataRefs(ctx context.Context, filter database.Filter) (message fftypes.DataRefs, res *database.FilterResult, err error)

func (*SQLCommon) GetDatatypeByID

func (s *SQLCommon) GetDatatypeByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Datatype, err error)

func (*SQLCommon) GetDatatypeByName

func (s *SQLCommon) GetDatatypeByName(ctx context.Context, ns, name, version string) (message *fftypes.Datatype, err error)

func (*SQLCommon) GetDatatypes

func (s *SQLCommon) GetDatatypes(ctx context.Context, filter database.Filter) (message []*fftypes.Datatype, res *database.FilterResult, err error)

func (*SQLCommon) GetEventByID

func (s *SQLCommon) GetEventByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Event, err error)

func (*SQLCommon) GetEvents

func (s *SQLCommon) GetEvents(ctx context.Context, filter database.Filter) (message []*fftypes.Event, res *database.FilterResult, err error)

func (*SQLCommon) GetGroupByHash

func (s *SQLCommon) GetGroupByHash(ctx context.Context, hash *fftypes.Bytes32) (group *fftypes.Group, err error)

func (*SQLCommon) GetGroups

func (s *SQLCommon) GetGroups(ctx context.Context, filter database.Filter) (group []*fftypes.Group, res *database.FilterResult, err error)

func (*SQLCommon) GetMessageByID

func (s *SQLCommon) GetMessageByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Message, err error)

func (*SQLCommon) GetMessageRefs

func (s *SQLCommon) GetMessageRefs(ctx context.Context, filter database.Filter) ([]*fftypes.MessageRef, *database.FilterResult, error)

func (*SQLCommon) GetMessages

func (s *SQLCommon) GetMessages(ctx context.Context, filter database.Filter) (message []*fftypes.Message, fr *database.FilterResult, err error)

func (*SQLCommon) GetMessagesForData

func (s *SQLCommon) GetMessagesForData(ctx context.Context, dataID *fftypes.UUID, filter database.Filter) (message []*fftypes.Message, fr *database.FilterResult, err error)

func (*SQLCommon) GetNamespace

func (s *SQLCommon) GetNamespace(ctx context.Context, name string) (message *fftypes.Namespace, err error)

func (*SQLCommon) GetNamespaces

func (s *SQLCommon) GetNamespaces(ctx context.Context, filter database.Filter) (message []*fftypes.Namespace, fr *database.FilterResult, err error)

func (*SQLCommon) GetNextPinByContextAndIdentity

func (s *SQLCommon) GetNextPinByContextAndIdentity(ctx context.Context, context *fftypes.Bytes32, identity string) (message *fftypes.NextPin, err error)

func (*SQLCommon) GetNextPinByHash

func (s *SQLCommon) GetNextPinByHash(ctx context.Context, hash *fftypes.Bytes32) (message *fftypes.NextPin, err error)

func (*SQLCommon) GetNextPins

func (s *SQLCommon) GetNextPins(ctx context.Context, filter database.Filter) (message []*fftypes.NextPin, fr *database.FilterResult, err error)

func (*SQLCommon) GetNode

func (s *SQLCommon) GetNode(ctx context.Context, owner, name string) (message *fftypes.Node, err error)

func (*SQLCommon) GetNodeByID

func (s *SQLCommon) GetNodeByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Node, err error)

func (*SQLCommon) GetNodes

func (s *SQLCommon) GetNodes(ctx context.Context, filter database.Filter) (message []*fftypes.Node, fr *database.FilterResult, err error)

func (*SQLCommon) GetNonce

func (s *SQLCommon) GetNonce(ctx context.Context, context *fftypes.Bytes32) (message *fftypes.Nonce, err error)

func (*SQLCommon) GetNonces

func (s *SQLCommon) GetNonces(ctx context.Context, filter database.Filter) (message []*fftypes.Nonce, fr *database.FilterResult, err error)

func (*SQLCommon) GetOffset

func (s *SQLCommon) GetOffset(ctx context.Context, t fftypes.OffsetType, name string) (message *fftypes.Offset, err error)

func (*SQLCommon) GetOffsets

func (s *SQLCommon) GetOffsets(ctx context.Context, filter database.Filter) (message []*fftypes.Offset, fr *database.FilterResult, err error)

func (*SQLCommon) GetOperationByID

func (s *SQLCommon) GetOperationByID(ctx context.Context, id *fftypes.UUID) (operation *fftypes.Operation, err error)

func (*SQLCommon) GetOperations

func (s *SQLCommon) GetOperations(ctx context.Context, filter database.Filter) (operation []*fftypes.Operation, fr *database.FilterResult, err error)

func (*SQLCommon) GetOrganizationByID

func (s *SQLCommon) GetOrganizationByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Organization, err error)

func (*SQLCommon) GetOrganizationByIdentity

func (s *SQLCommon) GetOrganizationByIdentity(ctx context.Context, identity string) (message *fftypes.Organization, err error)

func (*SQLCommon) GetOrganizationByName

func (s *SQLCommon) GetOrganizationByName(ctx context.Context, name string) (message *fftypes.Organization, err error)

func (*SQLCommon) GetOrganizations

func (s *SQLCommon) GetOrganizations(ctx context.Context, filter database.Filter) (message []*fftypes.Organization, fr *database.FilterResult, err error)

func (*SQLCommon) GetPins

func (s *SQLCommon) GetPins(ctx context.Context, filter database.Filter) (message []*fftypes.Pin, fr *database.FilterResult, err error)

func (*SQLCommon) GetSubscriptionByID

func (s *SQLCommon) GetSubscriptionByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Subscription, err error)

func (*SQLCommon) GetSubscriptionByName

func (s *SQLCommon) GetSubscriptionByName(ctx context.Context, ns, name string) (message *fftypes.Subscription, err error)

func (*SQLCommon) GetSubscriptions

func (s *SQLCommon) GetSubscriptions(ctx context.Context, filter database.Filter) (message []*fftypes.Subscription, fr *database.FilterResult, err error)

func (*SQLCommon) GetTokenAccount

func (s *SQLCommon) GetTokenAccount(ctx context.Context, protocolID, tokenIndex, identity string) (message *fftypes.TokenAccount, err error)

func (*SQLCommon) GetTokenAccounts

func (s *SQLCommon) GetTokenAccounts(ctx context.Context, filter database.Filter) ([]*fftypes.TokenAccount, *database.FilterResult, error)

func (*SQLCommon) GetTokenPool

func (s *SQLCommon) GetTokenPool(ctx context.Context, ns string, name string) (message *fftypes.TokenPool, err error)

func (*SQLCommon) GetTokenPoolByID

func (s *SQLCommon) GetTokenPoolByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.TokenPool, err error)

func (*SQLCommon) GetTokenPoolByProtocolID

func (s *SQLCommon) GetTokenPoolByProtocolID(ctx context.Context, id string) (*fftypes.TokenPool, error)

func (*SQLCommon) GetTokenPools

func (s *SQLCommon) GetTokenPools(ctx context.Context, filter database.Filter) (message []*fftypes.TokenPool, fr *database.FilterResult, err error)

func (*SQLCommon) GetTransactionByID

func (s *SQLCommon) GetTransactionByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Transaction, err error)

func (*SQLCommon) GetTransactions

func (s *SQLCommon) GetTransactions(ctx context.Context, filter database.Filter) (message []*fftypes.Transaction, fr *database.FilterResult, err error)

func (*SQLCommon) Init

func (s *SQLCommon) Init(ctx context.Context, provider Provider, prefix config.Prefix, callbacks database.Callbacks, capabilities *database.Capabilities) (err error)

func (*SQLCommon) InitPrefix

func (s *SQLCommon) InitPrefix(provider Provider, prefix config.Prefix)

func (*SQLCommon) InsertBlob

func (s *SQLCommon) InsertBlob(ctx context.Context, blob *fftypes.Blob) (err error)

func (*SQLCommon) InsertEvent

func (s *SQLCommon) InsertEvent(ctx context.Context, event *fftypes.Event) (err error)

func (*SQLCommon) InsertMessageLocal

func (s *SQLCommon) InsertMessageLocal(ctx context.Context, message *fftypes.Message) (err error)

func (*SQLCommon) InsertNextPin

func (s *SQLCommon) InsertNextPin(ctx context.Context, nextpin *fftypes.NextPin) (err error)

func (*SQLCommon) RunAsGroup

func (s *SQLCommon) RunAsGroup(ctx context.Context, fn func(ctx context.Context) error) error

func (*SQLCommon) SetPinDispatched

func (s *SQLCommon) SetPinDispatched(ctx context.Context, sequence int64) (err error)

func (*SQLCommon) UpdateBatch

func (s *SQLCommon) UpdateBatch(ctx context.Context, id *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpdateData

func (s *SQLCommon) UpdateData(ctx context.Context, id *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpdateDatatype

func (s *SQLCommon) UpdateDatatype(ctx context.Context, id *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpdateEvent

func (s *SQLCommon) UpdateEvent(ctx context.Context, id *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpdateGroup

func (s *SQLCommon) UpdateGroup(ctx context.Context, hash *fftypes.Bytes32, update database.Update) (err error)

func (*SQLCommon) UpdateGroups

func (s *SQLCommon) UpdateGroups(ctx context.Context, filter database.Filter, update database.Update) (err error)

func (*SQLCommon) UpdateMessage

func (s *SQLCommon) UpdateMessage(ctx context.Context, msgid *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpdateMessages

func (s *SQLCommon) UpdateMessages(ctx context.Context, filter database.Filter, update database.Update) (err error)

func (*SQLCommon) UpdateNextPin

func (s *SQLCommon) UpdateNextPin(ctx context.Context, sequence int64, update database.Update) (err error)

func (*SQLCommon) UpdateNode

func (s *SQLCommon) UpdateNode(ctx context.Context, id *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpdateOffset

func (s *SQLCommon) UpdateOffset(ctx context.Context, rowID int64, update database.Update) (err error)

func (*SQLCommon) UpdateOperation

func (s *SQLCommon) UpdateOperation(ctx context.Context, id *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpdateOrganization

func (s *SQLCommon) UpdateOrganization(ctx context.Context, id *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpdateSubscription

func (s *SQLCommon) UpdateSubscription(ctx context.Context, namespace, name string, update database.Update) (err error)

func (*SQLCommon) UpdateTransaction

func (s *SQLCommon) UpdateTransaction(ctx context.Context, id *fftypes.UUID, update database.Update) (err error)

func (*SQLCommon) UpsertBatch

func (s *SQLCommon) UpsertBatch(ctx context.Context, batch *fftypes.Batch, allowHashUpdate bool) (err error)

func (*SQLCommon) UpsertConfigRecord

func (s *SQLCommon) UpsertConfigRecord(ctx context.Context, configRecord *fftypes.ConfigRecord, allowExisting bool) (err error)

func (*SQLCommon) UpsertData

func (s *SQLCommon) UpsertData(ctx context.Context, data *fftypes.Data, allowExisting, allowHashUpdate bool) (err error)

func (*SQLCommon) UpsertDatatype

func (s *SQLCommon) UpsertDatatype(ctx context.Context, datatype *fftypes.Datatype, allowExisting bool) (err error)

func (*SQLCommon) UpsertGroup

func (s *SQLCommon) UpsertGroup(ctx context.Context, group *fftypes.Group, allowExisting bool) (err error)

func (*SQLCommon) UpsertMessage

func (s *SQLCommon) UpsertMessage(ctx context.Context, message *fftypes.Message, allowExisting, allowHashUpdate bool) (err error)

func (*SQLCommon) UpsertNamespace

func (s *SQLCommon) UpsertNamespace(ctx context.Context, namespace *fftypes.Namespace, allowExisting bool) (err error)

func (*SQLCommon) UpsertNode

func (s *SQLCommon) UpsertNode(ctx context.Context, node *fftypes.Node, allowExisting bool) (err error)

func (*SQLCommon) UpsertNonceNext

func (s *SQLCommon) UpsertNonceNext(ctx context.Context, nonce *fftypes.Nonce) (err error)

func (*SQLCommon) UpsertOffset

func (s *SQLCommon) UpsertOffset(ctx context.Context, offset *fftypes.Offset, allowExisting bool) (err error)

func (*SQLCommon) UpsertOperation

func (s *SQLCommon) UpsertOperation(ctx context.Context, operation *fftypes.Operation, allowExisting bool) (err error)

func (*SQLCommon) UpsertOrganization

func (s *SQLCommon) UpsertOrganization(ctx context.Context, organization *fftypes.Organization, allowExisting bool) (err error)

func (*SQLCommon) UpsertPin

func (s *SQLCommon) UpsertPin(ctx context.Context, pin *fftypes.Pin) (err error)

func (*SQLCommon) UpsertSubscription

func (s *SQLCommon) UpsertSubscription(ctx context.Context, subscription *fftypes.Subscription, allowExisting bool) (err error)

func (*SQLCommon) UpsertTokenAccount

func (s *SQLCommon) UpsertTokenAccount(ctx context.Context, account *fftypes.TokenAccount) (err error)

func (*SQLCommon) UpsertTokenPool

func (s *SQLCommon) UpsertTokenPool(ctx context.Context, pool *fftypes.TokenPool) (err error)

func (*SQLCommon) UpsertTransaction

func (s *SQLCommon) UpsertTransaction(ctx context.Context, transaction *fftypes.Transaction, allowHashUpdate bool) (err error)

Jump to

Keyboard shortcuts

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