ddb

package
v0.0.0-...-5c68377 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheIterator

type CacheIterator interface {
	Iterator
	GetSize() int
	GetAt(index int) RecordBuffer
}

CacheIterator describes intreface to read query or scan cached result.

type CheckTrans

type CheckTrans interface {
	WriteTransExpression

	Values(Values) CheckTrans
	Value(name string, value interface{}) CheckTrans

	Condition(string) CheckTrans
}

CheckTrans describes the part of WriteTrans witch builds check-expression.

type CheckedExpression

type CheckedExpression interface {
	ss.NoCopy

	AllowConditionalCheckFail()
}

type CheckedTransExpression

type CheckedTransExpression interface {
	ss.NoCopy

	AllowConditionalCheckFail() ConditionalTransCheckFailPermission
}

type Client

type Client interface {
	ss.NoCopy

	Index(resultRecord IndexRecord) Index

	Get(KeyRecordBuffer) Get
	Find(KeyRecordBuffer) Find
	FindMany() FindMany
	Query(record RecordBuffer, keyCondition string, values Values) Query

	CreateIfNotExists(data DataRecord) CreateIfNotExists
	CreateOrReplace(data DataRecord) Create
	Update(key KeyRecord) Update
	Delete(key KeyRecord) Delete
	DeleteIfExisting(key KeyRecord) Delete

	Write(WriteTrans) TransResult
}

Client is a database client interface.

func GetClientInstance

func GetClientInstance() Client

GetClientInstance returns reference to client singleton.

type ConditionalCheckResult

type ConditionalCheckResult interface {
	IsPassed(conditions ...ConditionalTransCheckFailPermission) bool
}

type ConditionalTransCheckFailPermission

type ConditionalTransCheckFailPermission int

func (ConditionalTransCheckFailPermission) GetIndex

type Create

type Create interface {
	CheckedExpression

	Condition(string) Create
	Values(Values) Create

	Request() Result
}

type CreateIfNotExists

type CreateIfNotExists interface {
	CheckedExpression

	Request() Result
}

type CreateTrans

type CreateTrans interface {
	WriteTransExpression
	Values(Values) CreateTrans
	Value(name string, value interface{}) CreateTrans
	Alias(name, value string) CreateTrans
	Condition(string) CreateTrans
}

CreateTrans describes the part of WriteTrans witch builds create-expression.

type DataRecord

type DataRecord interface {
	Record
	GetData() interface{}
}

DataRecord describes database record interface with data.

type Delete

type Delete interface {
	CheckedExpression

	Condition(string) Delete
	Values(Values) Delete

	Request() Result
	RequestAndReturn(RecordBuffer) Result
}

Delete describes the interface to delete one record by key.

type DeleteTrans

type DeleteTrans interface {
	WriteTransExpression
	Values(Values) UpdateTrans
	Condition(string) UpdateTrans
}

DeleteTrans describes the part of WriteTrans witch builds delete-expression.

type Find

type Find interface {
	ss.NoCopy

	Request() bool
}

Find describes the interface to find one record by key.

type FindMany

type FindMany interface {
	ss.NoCopy

	SetTable(RecordBuffer, []Key) CacheIterator
	Request()
}

FindMany describes the interface to find many records by key.

type Get

type Get interface{ Request() }

Get describes the interface to query one record by key from a database.

type Index

type Index interface {
	Query(keyCondition string, values Values) Query
}

Index describes db-command interface for the table index.

type IndexRecord

type IndexRecord interface {
	RecordBuffer
	// GetIndex returns index name.
	GetIndex() string
	// GetIndexPartitionField returns index partition field name.
	GetIndexPartitionField() string
	// GetIndexSortField returns index sort field name.
	GetIndexSortField() string
	// GetIndexSortField returns index additional fields for record.
	GetProjection() []string
}

IndexRecord describes database index interface.

type Iterator

type Iterator interface {
	IteratorMover
	Get() RecordBuffer
}

Iterator describes intreface to read paged data from the database.

type IteratorMover

type IteratorMover interface {
	Next() bool
}

IteratorMover describes intreface to move iterator.

type Key

type Key interface{ GetKey() interface{} }

Key describes key methods.

type KeyRecord

type KeyRecord interface {
	Record
	Key
}

KeyRecord describes database record interface without data but with key.

type KeyRecordBuffer

type KeyRecordBuffer interface {
	RecordBuffer
	Key
}

KeyRecordBuffer describes database record interface without data but with key and allows to write database response.

type MembershipVersion

type MembershipVersion uint

MembershipVersion is a version of membership.

func NewMembershipVersion

func NewMembershipVersion(source uint) MembershipVersion

NewMembershipVersion creates new membership version instance.

type Query

type Query interface {
	ss.NoCopy

	Filter(string) Query
	Limit(int64) Query
	Descending() Query
	RequestOne() bool
	RequestPaged() Iterator
	RequestAll() CacheIterator
}

Query describes the interface to query records from a database.

type Record

type Record interface {
	// GetTable returns table name.
	GetTable() string
	// GetKeyPartitionField returns partition field name.
	GetKeyPartitionField() string
	// GetKeySortField returns sort field name.
	GetKeySortField() string
}

Record describes database record interface without data.

type RecordBuffer

type RecordBuffer interface {
	Record
	Clear()
}

RecordBuffer describes database record for write database response.

type Result

type Result bool

func (Result) IsSuccess

func (result Result) IsSuccess() bool

type TransResult

type TransResult interface {
	IsSuccess() bool
	ParseConditions() ConditionalCheckResult

	MarshalLogMsg(destination map[string]interface{})
}

type Update

type Update interface {
	CheckedExpression

	Set(expression string) Update
	Remove(fieldName string) Update
	Expression(expression string) Update

	Values(Values) Update
	Value(name string, value interface{}) Update

	Alias(name, value string) Update

	Condition(string) Update

	Request() Result
	RequestAndReturn(RecordBuffer) Result
}

Update describes the interface to update one record by key.

type UpdateTrans

type UpdateTrans interface {
	WriteTransExpression
	Values(Values) UpdateTrans
	Value(name string, value interface{}) UpdateTrans
	Alias(name, value string) UpdateTrans
	Condition(string) UpdateTrans
}

UpdateTrans describes the part of WriteTrans witch builds update-expression.

type Values

type Values map[string]interface{}

Values is an abstract value set type.

func (Values) Marshal

func (values Values) Marshal(dest *map[string]*dynamodb.AttributeValue)

Marshal converts values into Dynamodb values format.

type WriteTrans

type WriteTrans interface {
	ss.NoCopy

	IsEmpty() bool
	GetSize() int

	CreateIfNotExists(DataRecord) CreateTrans
	CreateOrReplace(DataRecord) CreateTrans
	Replace(DataRecord) CreateTrans
	Check(KeyRecord) CheckTrans
	Update(key KeyRecord, update string) UpdateTrans
	Delete(KeyRecord) DeleteTrans
	DeleteIfExisting(KeyRecord) DeleteTrans

	MarshalLogMsg(destination map[string]interface{})

	GetResult() *dynamodb.TransactWriteItemsInput
	// contains filtered or unexported methods
}

WriteTrans helps to build write-transaction.

func NewWriteTrans

func NewWriteTrans(isConditionalCheckFail bool) WriteTrans

NewWriteTrans creates new write transaction builder.

type WriteTransExpression

type WriteTransExpression interface{ CheckedTransExpression }

WriteTransExpression describes the part of WriteTrans witch builds typed expression.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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