v1

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 5 Imported by: 0

README

This directory uses `aws-sdk-go` and the expression objects generated are compatible with `aws-sdk-go` dynamoDB funtionalities.

Documentation

Index

Constants

View Source
const (
	DDBAtributeNameCancatenator = "."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder interface {
	// contains filtered or unexported methods
}

type Conditioner

type Conditioner interface {
	// contains filtered or unexported methods
}

type DDBItemExpressionBuilder

type DDBItemExpressionBuilder[T any] struct {
	// contains filtered or unexported fields
}

func NewDDBItemExpressionBuilder

func NewDDBItemExpressionBuilder[T TreeBuilder[T]](treeBuilder T) DDBItemExpressionBuilder[T]

func (DDBItemExpressionBuilder[T]) Build

func (d DDBItemExpressionBuilder[T]) Build() error

Build creates additional tree structure for attributes of List/Set data type this has to be invoked before any builder can be built

func (DDBItemExpressionBuilder[T]) BuildConditionBuilder

func (d DDBItemExpressionBuilder[T]) BuildConditionBuilder() *expression.ConditionBuilder

BuildConditionBuilder builds a ConditionBuilder by aggregating all the condition of this expression builder tree

func (DDBItemExpressionBuilder[T]) BuildKeyConditionBuilder

func (d DDBItemExpressionBuilder[T]) BuildKeyConditionBuilder() *expression.KeyConditionBuilder

BuildKeyConditionBuilder builds a KeyConditionBuilder by aggregating all the KeyCondition of this expression builder tree

func (DDBItemExpressionBuilder[T]) BuildProjectionBuilder

func (d DDBItemExpressionBuilder[T]) BuildProjectionBuilder() (*expression.ProjectionBuilder, error)

BuildProjectionBuilder builds a ProjectionBuilder by aggregating all the projection of this expression builder tree

func (DDBItemExpressionBuilder[T]) BuildUpdateBuilder

func (d DDBItemExpressionBuilder[T]) BuildUpdateBuilder() (*expression.UpdateBuilder, error)

BuildUpdateBuilder builds a UpdateBuilder by aggregating all the update operation of this expression builder tree

func (DDBItemExpressionBuilder[T]) DDBItemRoot

func (d DDBItemExpressionBuilder[T]) DDBItemRoot() *DynamoAttribute[T]

type DynamoAttribute

type DynamoAttribute[T any] struct {
	// contains filtered or unexported fields
}

Represents a dyanmo db attribute

func NewDynamoAttribute

func NewDynamoAttribute[T any]() *DynamoAttribute[T]

func (*DynamoAttribute[T]) AR

func (da *DynamoAttribute[T]) AR() T

AR returns the type `T` held by this node access refernece is used in direct member selection

func (*DynamoAttribute[T]) AddValue

func (da *DynamoAttribute[T]) AddValue(operation DynamoOperation, value any)

AddValue adds a value which will be used to update `this` attributes

func (*DynamoAttribute[T]) AndWithCondition

func (da *DynamoAttribute[T]) AndWithCondition() func(conditionBuilder expression.ConditionBuilder)

AndWithCondition adds a new condition to `this` attributes existing conditions using `AND` NOTE: conditionBuilder represent any valid condition, zero value of struct `ConditionBuilder` might give build error

func (*DynamoAttribute[T]) GetName

func (da *DynamoAttribute[T]) GetName() string

func (*DynamoAttribute[T]) GetNameBuilder

func (da *DynamoAttribute[T]) GetNameBuilder() expression.NameBuilder

func (*DynamoAttribute[T]) Project

func (da *DynamoAttribute[T]) Project() error

Project marks `this` attribute for projection

func (*DynamoAttribute[T]) WithAccessReference

func (da *DynamoAttribute[T]) WithAccessReference(accessReference T) *DynamoAttribute[T]

WithAccessReference builds `this` DynamoAttribute with an access reference access refernece is used in direct member selection

func (*DynamoAttribute[T]) WithChildAttribute

func (da *DynamoAttribute[T]) WithChildAttribute(childAttribute interface{}) *DynamoAttribute[T]

WithChildAttribute builds `this` DynamoAttribute child attribute which are child nodes holding member attribute of type `T`

func (*DynamoAttribute[T]) WithName

func (da *DynamoAttribute[T]) WithName(name string) *DynamoAttribute[T]

WithName builds `this` DynamoAttribute with a dynamo db attribute name

type DynamoKeyAttribute

type DynamoKeyAttribute[T any] struct {

	// Name of the dynamo attribute as defined in DB
	Name string
	// contains filtered or unexported fields
}

Represents a dyanmo db primary key attribute

func NewDynamoKeyAttribute

func NewDynamoKeyAttribute[T any]() *DynamoKeyAttribute[T]

func (*DynamoKeyAttribute[T]) AndWithCondition

func (dka *DynamoKeyAttribute[T]) AndWithCondition() func(keyConditionBuilder expression.KeyConditionBuilder)

AndWithCondition adds a new condition to `this` attributes existing conditions using `AND` NOTE: keyConditionBuilder represent any valid condition, zero value of struct `KeyConditionBuilder` might give build error

func (*DynamoKeyAttribute[T]) GetKeyBuilder

func (dka *DynamoKeyAttribute[T]) GetKeyBuilder() expression.KeyBuilder

func (*DynamoKeyAttribute[T]) GetName

func (dka *DynamoKeyAttribute[T]) GetName() string

func (*DynamoKeyAttribute[T]) Project

func (dka *DynamoKeyAttribute[T]) Project() error

Project marks `this` attribute for projection

func (*DynamoKeyAttribute[T]) WithName

func (dka *DynamoKeyAttribute[T]) WithName(name string) *DynamoKeyAttribute[T]

WithName builds `this` DynamoKeyAttribute with a dynamo db attribute name

type DynamoListAttribute

type DynamoListAttribute[T any] struct {
	// contains filtered or unexported fields
}

Represents list/set datastructure in dynamo db T specifies the type of data stored in the list

Current Limitations: 1 - Lists in dynamo db can store attributes of different types but we are LIMITING this to single type 2 - List of list is NOT supported currently 3 - List of object is supported but list of object containing another list is NOT

func NewDynamoListAttribute

func NewDynamoListAttribute[T any]() *DynamoListAttribute[T]

func (*DynamoListAttribute[T]) AR

func (dla *DynamoListAttribute[T]) AR() T

AR returns the type `T` held by this node access refernece is used in direct member selection

func (*DynamoListAttribute[T]) AddListItem

func (dla *DynamoListAttribute[T]) AddListItem(listItemsIndex ...int) error

AddListItem add a node in the list

func (*DynamoListAttribute[T]) AddValue

func (dla *DynamoListAttribute[T]) AddValue(operation DynamoOperation, value any)

func (*DynamoListAttribute[T]) AndWithCondition

func (dla *DynamoListAttribute[T]) AndWithCondition() func(conditionBuilder expression.ConditionBuilder)

NOTE: conditionBuilder represent any valid condition, zero value of struct `ConditionBuilder` might give build error

func (*DynamoListAttribute[T]) GetName

func (dla *DynamoListAttribute[T]) GetName() string

func (*DynamoListAttribute[T]) GetNameBuilder

func (dla *DynamoListAttribute[T]) GetNameBuilder() expression.NameBuilder

func (*DynamoListAttribute[T]) Index

func (dla *DynamoListAttribute[T]) Index(listAttributeIndex int) *DynamoAttribute[T]

func (*DynamoListAttribute[T]) Project

func (dla *DynamoListAttribute[T]) Project() error

Project marks `this` attribute for projection

func (*DynamoListAttribute[T]) WithListItemAccessReference

func (dla *DynamoListAttribute[T]) WithListItemAccessReference(listItemAccessReference T) *DynamoListAttribute[T]

WithListItemAccessReference builds `this` DynamoListAttribute with an access reference access refernece is used in direct member selection

NOTE: List/Set will hold same type `T`

func (*DynamoListAttribute[T]) WithName

func (dla *DynamoListAttribute[T]) WithName(name string) *DynamoListAttribute[T]

WithName builds `this` DynamoListAttribute with a dynamo db attribute name

type DynamoOperation

type DynamoOperation int
const (
	NO_OP DynamoOperation = iota
	GET
	UPDATE_SET
	UPDATE_REMOVE
	UPDATE_ADD
	UPDATE_DELETE
)

type KeyConditioner

type KeyConditioner interface {
	// contains filtered or unexported methods
}

type Projector

type Projector interface {
	// contains filtered or unexported methods
}

TODO: merge this with Builder

type TreeBuilder

type TreeBuilder[T any] interface {
	// BuildTree builds the tree and returns the
	// root node i.e. *DynamoAttribute
	BuildTree(string) *DynamoAttribute[T]
}

This is implemented by structs using this package

type Updater

type Updater interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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