dynamodb

package
v0.0.0-...-fb1d941 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DynamoDBOpEqual        = "="
	DynamoDBOpNotEqual     = "!="
	DynamoDBOpAttrExist    = "attribute_exists"
	DynamoDBOpAttrNotExist = "attribute_not_exists"
	DynamoDBOpContains     = "contains"    //"CONTAINS"
	DynamoDBOpNotContains  = "not_contain" //"NOT_CONTAINS"
)

Variables

APIObjectVersioner implements Versioner

Functions

func BuildScanFilterAttr

func BuildScanFilterAttr(objPtr runtime.Object, p storage.SelectionPredicate) (filterExpression string, expressionAttributeNames map[string]*string, expressionAttributeValues map[string]*awsdb.AttributeValue)

func BuildUpdateAttr

func BuildUpdateAttr(newObj runtime.Object, oldObj runtime.Object, attr map[string]interface{}) (updateExpression string, expressionAttributeNames map[string]*string, expressionAttributeValues map[string]*awsdb.AttributeValue, err error)

BuildUpdateAttr input attr like as:

type nested Struct{
	key1 string
	key2 string
}

type Test Struct{
	key1 string `json:"key1,omitempty"`
	key2 string
	nested nested `json:"nested,omitempty"`
}

if you want update Test.key1 and nested.key1 will be have map:

attr:=map[string]interface{}{
	"key1":value1,
	"nested.#key1":value2,
}

func ConvertByteToMap

func ConvertByteToMap(data []byte) (map[string]interface{}, error)

func ConvertTOJson

func ConvertTOJson(items *[]map[string]*awsdb.AttributeValue) ([]map[string]interface{}, int64, error)

func CreateTable

func CreateTable(dbHandler *awsdb.DynamoDB, table string) (string, error)

func GetListItemObj

func GetListItemObj(listObj runtime.Object) (listPtr interface{}, itemObj runtime.Object, err error)

func New

func New(sess *session.Session, table string, codec runtime.Codec) storage.Interface

func RandStringRunes

func RandStringRunes(n int) string

func ScanFilterWithFileds

func ScanFilterWithFileds(p storage.SelectionPredicate,
	expressionAttributeNames map[string]*string,
	expressionAttributeValues map[string]*awsdb.AttributeValue) (expression []string)

ScanFilterWithFileds range FieldSelector convert into dynamodb scan return string is a slice constain of filter expression for dynamodb

func ScanFilterWithLables

func ScanFilterWithLables(p storage.SelectionPredicate,
	expressionAttributeNames map[string]*string,
	expressionAttributeValues map[string]*awsdb.AttributeValue) (expression []string)

ScanFilterWithFileds range LablesSelector convert into dynamodb scan return string is a slice constain of filter expression for dynamodb

Types

type APIObjectVersioner

type APIObjectVersioner struct{}

APIObjectVersioner implements versioning and extracting mysql node information for objects that have an embedded ObjectMeta or ListMeta field.

func (APIObjectVersioner) CompareResourceVersion

func (a APIObjectVersioner) CompareResourceVersion(lhs, rhs runtime.Object) int

CompareResourceVersion compares etcd resource versions. Outside this API they are all strings, but etcd resource versions are special, they're actually ints, so we can easily compare them.

func (APIObjectVersioner) ObjectResourceVersion

func (a APIObjectVersioner) ObjectResourceVersion(obj runtime.Object) (uint64, error)

ObjectResourceVersion implements Versioner

func (APIObjectVersioner) ParseListResourceVersion

func (a APIObjectVersioner) ParseListResourceVersion(resourceVersion string) (uint64, error)

ParseListResourceVersion takes a resource version argument and converts it to the etcd version. TODO: reevaluate whether it is really clearer to have both this and the Watch version of this function, since they perform the same logic.

func (APIObjectVersioner) ParseResourceVersion

func (a APIObjectVersioner) ParseResourceVersion(resourceVersion string) (uint64, error)

ParseResourceVersion takes a resource version argument and converts it to the etcd version. For watch we should pass to helper.Watch(). Because resourceVersion is an opaque value, the default watch behavior for non-zero watch is to watch the next value (if you pass "1", you will see updates from "2" onwards).

func (APIObjectVersioner) ParseWatchResourceVersion

func (a APIObjectVersioner) ParseWatchResourceVersion(resourceVersion string) (uint64, error)

ParseWatchResourceVersion takes a resource version argument and converts it to the etcd version we should pass to helper.Watch(). Because resourceVersion is an opaque value, the default watch behavior for non-zero watch is to watch the next value (if you pass "1", you will see updates from "2" onwards).

func (APIObjectVersioner) PrepareObjectForStorage

func (a APIObjectVersioner) PrepareObjectForStorage(obj runtime.Object) error

PrepareObjectForStorage clears resource version and self link prior to writing to etcd.

func (APIObjectVersioner) UpdateList

func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint64, nextKey string, count *int64) error

UpdateList implements Versioner

func (APIObjectVersioner) UpdateObject

func (a APIObjectVersioner) UpdateObject(obj runtime.Object, resourceVersion uint64) error

UpdateObject implements Versioner

Jump to

Keyboard shortcuts

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