Documentation
¶
Overview ¶
Package aerospike provides a client to connect and interact with an Aerospike cluster. This is the official Go implementation of the Aerospike Client.
Index ¶
- Constants
- Variables
- func Base64ToCDTContext(b64 string) ([]*CDTContext, Error)
- func ExpFromAEL(text string) (*Expression, Error)
- func ExpFromBase64(str string) (*Expression, Error)
- func GetNodeBatchRead(cluster *Cluster, key *Key, replica ReplicaPolicy, replicaSC ReplicaPolicy, ...) (*Node, Error)
- func GetNodeBatchWrite(cluster *Cluster, key *Key, replica ReplicaPolicy, prevNode *Node, ...) (*Node, Error)
- func KeepConnection(err Error) bool
- func NewClient(hostname string, port int) (*Client, Error)
- func NewClientWithPolicy(policy *ClientPolicy, hostname string, port int) (*Client, Error)
- func NewClientWithPolicyAndHost(policy *ClientPolicy, hosts ...*Host) (*Client, Error)
- func NewCluster(policy *atomic.Pointer[ClientPolicy], hosts []*Host) (*Cluster, Error)
- func NewConnection(policy *ClientPolicy, host *Host) (*Connection, Error)
- func NewHosts(addresses ...string) ([]*Host, Error)
- func NewKey(namespace string, setName string, key any) (*Key, Error)
- func NewKeyWithDigest(namespace string, setName string, key any, digest []byte) (*Key, Error)
- func PartitionForRead(cluster *Cluster, policy *BasePolicy, key *Key) (*Partition, Error)
- func PartitionForWrite(cluster *Cluster, policy *BasePolicy, key *Key) (*Partition, Error)
- func SetAerospikeTag(tag string)
- func SetLuaPath(lpath string)
- type AbortStatus
- type AdminCommand
- func (acmd *AdminCommand) QueryRole(conn *Connection, policy *AdminPolicy, roleName string) (*Role, Error)
- func (acmd *AdminCommand) QueryRoles(conn *Connection, policy *AdminPolicy) ([]*Role, Error)
- func (acmd *AdminCommand) QueryUser(conn *Connection, policy *AdminPolicy, user string) (*UserRoles, Error)
- func (acmd *AdminCommand) QueryUsers(conn *Connection, policy *AdminPolicy) ([]*UserRoles, Error)
- type AdminPolicy
- type AerospikeBlob
- type AerospikeError
- func (ase *AerospikeError) As(target any) bool
- func (ase *AerospikeError) Error() string
- func (ase *AerospikeError) Is(e error) bool
- func (ase *AerospikeError) IsInDoubt() bool
- func (ase *AerospikeError) Matches(rcs ...types.ResultCode) bool
- func (ase *AerospikeError) Trace() string
- func (ase *AerospikeError) Unwrap() error
- type AuthMode
- type BasePolicy
- type BatchDelete
- type BatchDeletePolicy
- type BatchOffsets
- type BatchPolicy
- type BatchRead
- type BatchReadPolicy
- type BatchRecord
- type BatchRecordIfc
- type BatchUDF
- type BatchUDFPolicy
- type BatchWrite
- type BatchWritePolicy
- type Bin
- type BinMap
- type BitOverflowAction
- type BitPolicy
- type BitResizeFlags
- type BoolValue
- type BufferEx
- type BytesValue
- type CDTContext
- func CtxAllChildren() *CDTContext
- func CtxAllChildrenWithFilter(exp *Expression) *CDTContext
- func CtxAndFilter(exp *Expression) *CDTContext
- func CtxListIndex(index int) *CDTContext
- func CtxListIndexCreate(index int, order ListOrderType, pad bool) *CDTContext
- func CtxListRank(rank int) *CDTContext
- func CtxListValue(key Value) *CDTContext
- func CtxMapBytesKeysIn(keys ...[]byte) *CDTContextdeprecated
- func CtxMapIndex(index int) *CDTContext
- func CtxMapIntKeysIn(keys ...int) *CDTContextdeprecated
- func CtxMapKey(key Value) *CDTContext
- func CtxMapKeyCreate(key Value, order mapOrderType) *CDTContext
- func CtxMapKeysIn(keys ...Value) *CDTContext
- func CtxMapRank(rank int) *CDTContext
- func CtxMapStringKeysIn(keys ...string) *CDTContextdeprecated
- func CtxMapValue(value Value) *CDTContext
- type Client
- func (clnt *Client) Abort(txn *Txn) (AbortStatus, Error)
- func (clnt *Client) Add(policy *WritePolicy, key *Key, binMap BinMap) Error
- func (clnt *Client) AddBins(policy *WritePolicy, key *Key, bins ...*Bin) Error
- func (clnt *Client) Append(policy *WritePolicy, key *Key, binMap BinMap) Error
- func (clnt *Client) AppendBins(policy *WritePolicy, key *Key, bins ...*Bin) Error
- func (clnt *Client) BatchDelete(policy *BatchPolicy, deletePolicy *BatchDeletePolicy, keys []*Key) ([]*BatchRecord, Error)
- func (clnt *Client) BatchExecute(policy *BatchPolicy, udfPolicy *BatchUDFPolicy, keys []*Key, ...) ([]*BatchRecord, Error)
- func (clnt *Client) BatchExists(policy *BatchPolicy, keys []*Key) ([]bool, Error)
- func (clnt *Client) BatchGet(policy *BatchPolicy, keys []*Key, binNames ...string) ([]*Record, Error)
- func (clnt *Client) BatchGetComplex(policy *BatchPolicy, records []*BatchRead) Error
- func (clnt *Client) BatchGetHeader(policy *BatchPolicy, keys []*Key) ([]*Record, Error)
- func (clnt *Client) BatchGetObjects(policy *BatchPolicy, keys []*Key, objects []any) (found []bool, err Error)
- func (clnt *Client) BatchGetOperate(policy *BatchPolicy, keys []*Key, ops ...*Operation) ([]*Record, Error)
- func (clnt *Client) BatchOperate(policy *BatchPolicy, records []BatchRecordIfc) Error
- func (clnt *Client) ChangePassword(policy *AdminPolicy, user string, password string) Error
- func (clnt *Client) Close()
- func (clnt *Client) Cluster() *Cluster
- func (clnt *Client) Commit(txn *Txn) (CommitStatus, Error)
- func (clnt *Client) CreateComplexIndex(policy *WritePolicy, namespace string, setName string, indexName string, ...) (*IndexTask, Error)
- func (clnt *Client) CreateIndex(policy *WritePolicy, namespace string, setName string, indexName string, ...) (*IndexTask, Error)
- func (clnt *Client) CreateIndexWithExpression(policy *WritePolicy, namespace string, setName string, indexName string, ...) (*IndexTask, Error)
- func (clnt *Client) CreatePKIUser(policy *AdminPolicy, user string, roles []string) Error
- func (clnt *Client) CreateRole(policy *AdminPolicy, roleName string, privileges []Privilege, ...) Error
- func (clnt *Client) CreateSetIndex(policy *WritePolicy, namespace string, setName string, indexName string) (*IndexTask, Error)
- func (clnt *Client) CreateUser(policy *AdminPolicy, user string, password string, roles []string) Error
- func (clnt *Client) Delete(policy *WritePolicy, key *Key) (bool, Error)
- func (clnt *Client) DisableMetrics()
- func (clnt *Client) DropIndex(policy *WritePolicy, namespace string, setName string, indexName string) Error
- func (clnt *Client) DropRole(policy *AdminPolicy, roleName string) Error
- func (clnt *Client) DropUser(policy *AdminPolicy, user string) Error
- func (clnt *Client) EnableMetrics(policy *MetricsPolicy)
- func (clnt *Client) Execute(policy *WritePolicy, key *Key, packageName string, functionName string, ...) (any, Error)
- func (clnt *Client) ExecuteUDF(policy *QueryPolicy, statement *Statement, packageName string, ...) (*ExecuteTask, Error)
- func (clnt *Client) ExecuteUDFNode(policy *QueryPolicy, node *Node, statement *Statement, packageName string, ...) (*ExecuteTask, Error)
- func (clnt *Client) Exists(policy *BasePolicy, key *Key) (bool, Error)
- func (clnt *Client) Get(policy *BasePolicy, key *Key, binNames ...string) (*Record, Error)
- func (clnt *Client) GetDefaultAdminPolicy() *AdminPolicy
- func (clnt *Client) GetDefaultBatchDeletePolicy() *BatchDeletePolicy
- func (clnt *Client) GetDefaultBatchPolicy() *BatchPolicy
- func (clnt *Client) GetDefaultBatchReadPolicy() *BatchReadPolicy
- func (clnt *Client) GetDefaultBatchUDFPolicy() *BatchUDFPolicy
- func (clnt *Client) GetDefaultBatchWritePolicy() *BatchWritePolicy
- func (clnt *Client) GetDefaultInfoPolicy() *InfoPolicy
- func (clnt *Client) GetDefaultPolicy() *BasePolicy
- func (clnt *Client) GetDefaultQueryPolicy() *QueryPolicy
- func (clnt *Client) GetDefaultScanPolicy() *ScanPolicy
- func (clnt *Client) GetDefaultTxnRollPolicy() *TxnRollPolicy
- func (clnt *Client) GetDefaultTxnVerifyPolicy() *TxnVerifyPolicy
- func (clnt *Client) GetDefaultWritePolicy() *WritePolicy
- func (clnt *Client) GetHeader(policy *BasePolicy, key *Key) (*Record, Error)
- func (clnt *Client) GetNodeNames() []string
- func (clnt *Client) GetNodes() []*Node
- func (clnt *Client) GetObject(policy *BasePolicy, key *Key, obj any) Error
- func (clnt *Client) GrantPrivileges(policy *AdminPolicy, roleName string, privileges []Privilege) Error
- func (clnt *Client) GrantRoles(policy *AdminPolicy, user string, roles []string) Error
- func (clnt *Client) IsConnected() bool
- func (clnt *Client) ListUDF(policy *BasePolicy) ([]*UDF, Error)
- func (clnt *Client) MetricsEnabled() bool
- func (clnt *Client) Operate(policy *WritePolicy, key *Key, operations ...*Operation) (*Record, Error)
- func (clnt *Client) Prepend(policy *WritePolicy, key *Key, binMap BinMap) Error
- func (clnt *Client) PrependBins(policy *WritePolicy, key *Key, bins ...*Bin) Error
- func (clnt *Client) Put(policy *WritePolicy, key *Key, binMap BinMap) Error
- func (clnt *Client) PutBins(policy *WritePolicy, key *Key, bins ...*Bin) Error
- func (clnt *Client) PutObject(policy *WritePolicy, key *Key, obj any) (err Error)
- func (clnt *Client) PutPayload(policy *WritePolicy, key *Key, payload []byte) Error
- func (clnt *Client) Query(policy *QueryPolicy, statement *Statement) (*Recordset, Error)
- func (clnt *Client) QueryAggregate(policy *QueryPolicy, statement *Statement, packageName, functionName string, ...) (*Recordset, Error)
- func (clnt *Client) QueryExecute(policy *QueryPolicy, writePolicy *WritePolicy, statement *Statement, ...) (*ExecuteTask, Error)
- func (clnt *Client) QueryNode(policy *QueryPolicy, node *Node, statement *Statement) (*Recordset, Error)
- func (clnt *Client) QueryNodeObjects(policy *QueryPolicy, node *Node, statement *Statement, objChan any) (*Recordset, Error)
- func (clnt *Client) QueryObjects(policy *QueryPolicy, statement *Statement, objChan any) (*Recordset, Error)
- func (clnt *Client) QueryPartitionObjects(policy *QueryPolicy, statement *Statement, objChan any, ...) (*Recordset, Error)
- func (clnt *Client) QueryPartitions(policy *QueryPolicy, statement *Statement, partitionFilter *PartitionFilter) (*Recordset, Error)
- func (clnt *Client) QueryRole(policy *AdminPolicy, role string) (res *Role, err Error)
- func (clnt *Client) QueryRoles(policy *AdminPolicy) (res []*Role, err Error)
- func (clnt *Client) QueryUser(policy *AdminPolicy, user string) (res *UserRoles, err Error)
- func (clnt *Client) QueryUsers(policy *AdminPolicy) (res []*UserRoles, err Error)
- func (clnt *Client) RegisterUDF(policy *WritePolicy, udfBody []byte, serverPath string, language Language) (*RegisterTask, Error)
- func (clnt *Client) RegisterUDFFromFile(policy *WritePolicy, clientPath string, serverPath string, language Language) (*RegisterTask, Error)
- func (clnt *Client) RemoveUDF(policy *WritePolicy, udfName string) (*RemoveTask, Error)
- func (clnt *Client) RevokePrivileges(policy *AdminPolicy, roleName string, privileges []Privilege) Error
- func (clnt *Client) RevokeRoles(policy *AdminPolicy, user string, roles []string) Error
- func (clnt *Client) ScanAll(apolicy *ScanPolicy, namespace string, setName string, binNames ...string) (*Recordset, Error)
- func (clnt *Client) ScanAllObjects(apolicy *ScanPolicy, objChan any, namespace string, setName string, ...) (*Recordset, Error)
- func (clnt *Client) ScanNode(apolicy *ScanPolicy, node *Node, namespace string, setName string, ...) (*Recordset, Error)
- func (clnt *Client) ScanNodeObjects(apolicy *ScanPolicy, node *Node, objChan any, namespace string, setName string, ...) (*Recordset, Error)
- func (clnt *Client) ScanPartitionObjects(apolicy *ScanPolicy, objChan any, partitionFilter *PartitionFilter, ...) (*Recordset, Error)
- func (clnt *Client) ScanPartitions(apolicy *ScanPolicy, partitionFilter *PartitionFilter, namespace string, ...) (*Recordset, Error)
- func (clnt *Client) SetDefaultAdminPolicy(policy *AdminPolicy)
- func (clnt *Client) SetDefaultBatchDeletePolicy(policy *BatchDeletePolicy)
- func (clnt *Client) SetDefaultBatchPolicy(policy *BatchPolicy)
- func (clnt *Client) SetDefaultBatchReadPolicy(policy *BatchReadPolicy)
- func (clnt *Client) SetDefaultBatchUDFPolicy(policy *BatchUDFPolicy)
- func (clnt *Client) SetDefaultBatchWritePolicy(policy *BatchWritePolicy)
- func (clnt *Client) SetDefaultInfoPolicy(policy *InfoPolicy)
- func (clnt *Client) SetDefaultPolicy(policy *BasePolicy)
- func (clnt *Client) SetDefaultQueryPolicy(policy *QueryPolicy)
- func (clnt *Client) SetDefaultScanPolicy(policy *ScanPolicy)
- func (clnt *Client) SetDefaultTxnRollPolicy(policy *TxnRollPolicy)
- func (clnt *Client) SetDefaultTxnVerifyPolicy(policy *TxnVerifyPolicy)
- func (clnt *Client) SetDefaultWritePolicy(policy *WritePolicy)
- func (clnt *Client) SetQuotas(policy *AdminPolicy, roleName string, readQuota, writeQuota uint32) Error
- func (clnt *Client) SetWhitelist(policy *AdminPolicy, roleName string, whitelist []string) Error
- func (clnt *Client) SetXDRFilter(policy *InfoPolicy, datacenter string, namespace string, filter *Expression) Error
- func (clnt *Client) Stats() (map[string]any, Error)
- func (clnt *Client) String() string
- func (clnt *Client) Touch(policy *WritePolicy, key *Key) Error
- func (clnt *Client) Truncate(policy *InfoPolicy, namespace, set string, beforeLastUpdate *time.Time) Error
- func (clnt *Client) WarmUp(count int) (int, Error)
- type ClientPolicy
- type Cluster
- func (clstr *Cluster) AddSeeds(hosts []*Host)
- func (clstr *Cluster) ClientPolicy() (res ClientPolicy)
- func (clstr *Cluster) Close()
- func (clstr *Cluster) DisableMetrics()
- func (clstr *Cluster) EnableMetrics(policy *MetricsPolicy)
- func (clstr *Cluster) GetAliases() map[Host]*Node
- func (clstr *Cluster) GetNodeByName(nodeName string) (*Node, Error)
- func (clstr *Cluster) GetNodes() []*Node
- func (clstr *Cluster) GetRandomNode() (*Node, Error)
- func (clstr *Cluster) GetSeedCount() int
- func (clstr *Cluster) GetSeeds() []Host
- func (clstr *Cluster) Healthy() Error
- func (clstr *Cluster) IsConnected() bool
- func (clstr *Cluster) MetricsEnabled() bool
- func (clstr *Cluster) MetricsPolicy() *MetricsPolicy
- func (clstr *Cluster) MigrationInProgress(timeout time.Duration) (res bool, err Error)
- func (clstr *Cluster) Password() (res []byte)
- func (clstr *Cluster) String() string
- func (clstr *Cluster) WaitUntilMigrationIsFinished(timeout time.Duration) Error
- func (clstr *Cluster) WarmUp(count int) (int, Error)
- type CommitError
- type CommitLevel
- type CommitStatus
- type Connection
- func (ctn *Connection) Close()
- func (ctn *Connection) IsConnected() bool
- func (ctn *Connection) Login(policy *ClientPolicy) Error
- func (ctn *Connection) Read(buf []byte, length int) (total int, aerr Error)
- func (ctn *Connection) RequestInfo(names ...string) (map[string]string, Error)
- func (ctn *Connection) SetTimeout(deadline time.Time, socketTimeout time.Duration) Error
- func (ctn *Connection) Write(buf []byte) (total int, aerr Error)
- type DropIndexTask
- type DynConfig
- type Error
- func CDTContextToBase64(ctxl []*CDTContext) (string, Error)
- func NewTxnCommitError(err CommitError, verifyRecords, rollRecords []*BatchRecord, cause Error) Error
- func PackBool(cmd BufferEx, val bool) (int, Error)
- func PackBytes(cmd BufferEx, b []byte) (int, Error)
- func PackFloat32(cmd BufferEx, val float32) (int, Error)
- func PackFloat64(cmd BufferEx, val float64) (int, Error)
- func PackInt64(cmd BufferEx, val int64) (int, Error)
- func PackJson(cmd BufferEx, theMap map[string]any) (int, Error)
- func PackList(cmd BufferEx, list ListIter) (int, Error)
- func PackMap(cmd BufferEx, theMap MapIter) (int, Error)
- func PackNil(cmd BufferEx) (int, Error)
- func PackString(cmd BufferEx, val string) (int, Error)
- func PackUInt64(cmd BufferEx, val uint64) (int, Error)
- type ExecuteTask
- type ExpCdtFlags
- type ExpReadFlags
- type ExpRegexFlags
- type ExpType
- type ExpWriteFlags
- type Expression
- func ExpAnd(exps ...*Expression) *Expression
- func ExpBinExists(name string) *Expression
- func ExpBinType(name string) *Expression
- func ExpBitAdd(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBitAnd(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBitB64Encode(bin *Expression) *Expression
- func ExpBitB64EncodeRange(byteOffset *Expression, byteSize *Expression, invertSize bool, bin *Expression) *Expression
- func ExpBitCount(bitOffset *Expression, bitSize *Expression, bin *Expression) *Expression
- func ExpBitGet(bitOffset *Expression, bitSize *Expression, bin *Expression) *Expression
- func ExpBitGetInt(bitOffset *Expression, bitSize *Expression, signed bool, bin *Expression) *Expression
- func ExpBitInsert(policy *BitPolicy, byteOffset *Expression, value *Expression, bin *Expression) *Expression
- func ExpBitLScan(bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression) *Expression
- func ExpBitLShift(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBitNot(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, bin *Expression) *Expression
- func ExpBitOr(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBitRScan(bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression) *Expression
- func ExpBitRShift(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBitRemove(policy *BitPolicy, byteOffset *Expression, byteSize *Expression, ...) *Expression
- func ExpBitResize(policy *BitPolicy, byteSize *Expression, resizeFlags BitResizeFlags, ...) *Expression
- func ExpBitSet(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBitSetInt(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBitSubtract(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBitXor(policy *BitPolicy, bitOffset *Expression, bitSize *Expression, ...) *Expression
- func ExpBlobBin(name string) *Expression
- func ExpBlobLoopVar(part LoopVarPart) *Expression
- func ExpBlobVal(val []byte) *Expression
- func ExpBoolBin(name string) *Expression
- func ExpBoolLoopVar(part LoopVarPart) *Expression
- func ExpBoolVal(val bool) *Expression
- func ExpCond(exps ...*Expression) *Expression
- func ExpDef(name string, value *Expression) *Expression
- func ExpDeviceSize() *Expressiondeprecated
- func ExpDigestModulo(modulo int64) *Expression
- func ExpEq(left *Expression, right *Expression) *Expression
- func ExpExclusive(exps ...*Expression) *Expression
- func ExpFloatBin(name string) *Expression
- func ExpFloatLoopVar(part LoopVarPart) *Expression
- func ExpFloatVal(val float64) *Expression
- func ExpGeoBin(name string) *Expression
- func ExpGeoCompare(left *Expression, right *Expression) *Expression
- func ExpGeoJSONLoopVar(part LoopVarPart) *Expression
- func ExpGeoVal(val string) *Expression
- func ExpGreater(left *Expression, right *Expression) *Expression
- func ExpGreaterEq(left *Expression, right *Expression) *Expression
- func ExpHLLAdd(policy *HLLPolicy, list *Expression, bin *Expression) *Expression
- func ExpHLLAddWithIndex(policy *HLLPolicy, list *Expression, indexBitCount *Expression, ...) *Expression
- func ExpHLLAddWithIndexAndMinHash(policy *HLLPolicy, list *Expression, indexBitCount *Expression, ...) *Expression
- func ExpHLLBin(name string) *Expression
- func ExpHLLDescribe(bin *Expression) *Expression
- func ExpHLLGetCount(bin *Expression) *Expression
- func ExpHLLGetIntersectCount(list *Expression, bin *Expression) *Expression
- func ExpHLLGetSimilarity(list *Expression, bin *Expression) *Expression
- func ExpHLLGetUnion(list *Expression, bin *Expression) *Expression
- func ExpHLLGetUnionCount(list *Expression, bin *Expression) *Expression
- func ExpHLLInit(policy *HLLPolicy, indexBitCount *Expression, bin *Expression) *Expression
- func ExpHLLInitWithMinHash(policy *HLLPolicy, indexBitCount *Expression, minHashCount *Expression, ...) *Expression
- func ExpHLLLoopVar(part LoopVarPart) *Expression
- func ExpHLLMayContain(list *Expression, bin *Expression) *Expression
- func ExpInList(value *Expression, list *Expression) *Expression
- func ExpInfinityValue() *Expression
- func ExpIntARShift(value *Expression, shift *Expression) *Expression
- func ExpIntAnd(exps ...*Expression) *Expression
- func ExpIntBin(name string) *Expression
- func ExpIntCount(exp *Expression) *Expression
- func ExpIntLScan(value *Expression, search *Expression) *Expression
- func ExpIntLShift(value *Expression, shift *Expression) *Expression
- func ExpIntLoopVar(part LoopVarPart) *Expression
- func ExpIntNot(exp *Expression) *Expression
- func ExpIntOr(exps ...*Expression) *Expression
- func ExpIntRScan(value *Expression, search *Expression) *Expression
- func ExpIntRShift(value *Expression, shift *Expression) *Expression
- func ExpIntVal(val int64) *Expression
- func ExpIntXor(exps ...*Expression) *Expression
- func ExpIsTombstone() *Expression
- func ExpKey(expType ExpType) *Expression
- func ExpKeyExists() *Expression
- func ExpLastUpdate() *Expression
- func ExpLess(left *Expression, right *Expression) *Expression
- func ExpLessEq(left *Expression, right *Expression) *Expression
- func ExpLet(exps ...*Expression) *Expression
- func ExpListAppend(policy *ListPolicy, value *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListAppendItems(policy *ListPolicy, list *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListBin(name string) *Expression
- func ExpListClear(bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListGetByIndex(returnType ListReturnType, valueType ExpType, index *Expression, ...) *Expression
- func ExpListGetByIndexRange(returnType ListReturnType, index *Expression, bin *Expression, ...) *Expression
- func ExpListGetByIndexRangeCount(returnType ListReturnType, index *Expression, count *Expression, ...) *Expression
- func ExpListGetByRank(returnType ListReturnType, valueType ExpType, rank *Expression, ...) *Expression
- func ExpListGetByRankRange(returnType ListReturnType, rank *Expression, bin *Expression, ...) *Expression
- func ExpListGetByRankRangeCount(returnType ListReturnType, rank *Expression, count *Expression, ...) *Expression
- func ExpListGetByValue(returnType ListReturnType, value *Expression, bin *Expression, ...) *Expression
- func ExpListGetByValueList(returnType ListReturnType, values *Expression, bin *Expression, ...) *Expression
- func ExpListGetByValueRange(returnType ListReturnType, valueBegin *Expression, valueEnd *Expression, ...) *Expression
- func ExpListGetByValueRelativeRankRange(returnType ListReturnType, value *Expression, rank *Expression, ...) *Expression
- func ExpListGetByValueRelativeRankRangeCount(returnType ListReturnType, value *Expression, rank *Expression, ...) *Expression
- func ExpListIncrement(policy *ListPolicy, index *Expression, value *Expression, bin *Expression, ...) *Expression
- func ExpListInsert(policy *ListPolicy, index *Expression, value *Expression, bin *Expression, ...) *Expression
- func ExpListInsertItems(policy *ListPolicy, index *Expression, list *Expression, bin *Expression, ...) *Expression
- func ExpListJoin(bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListJoinBySeparator(separator *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListLoopVar(part LoopVarPart) *Expression
- func ExpListRemoveByIndex(index *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListRemoveByIndexRange(returnType ListReturnType, index *Expression, bin *Expression, ...) *Expression
- func ExpListRemoveByIndexRangeCount(returnType ListReturnType, index *Expression, count *Expression, ...) *Expression
- func ExpListRemoveByRank(rank *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListRemoveByRankRange(returnType ListReturnType, rank *Expression, bin *Expression, ...) *Expression
- func ExpListRemoveByRankRangeCount(returnType ListReturnType, rank *Expression, count *Expression, ...) *Expression
- func ExpListRemoveByValue(returnType ListReturnType, value *Expression, bin *Expression, ...) *Expression
- func ExpListRemoveByValueList(returnType ListReturnType, values *Expression, bin *Expression, ...) *Expression
- func ExpListRemoveByValueRange(returnType ListReturnType, valueBegin *Expression, valueEnd *Expression, ...) *Expression
- func ExpListRemoveByValueRelativeRankRange(returnType ListReturnType, value *Expression, rank *Expression, ...) *Expression
- func ExpListRemoveByValueRelativeRankRangeCount(returnType ListReturnType, value *Expression, rank *Expression, ...) *Expression
- func ExpListSet(policy *ListPolicy, index *Expression, value *Expression, bin *Expression, ...) *Expression
- func ExpListSize(bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListSort(sortFlags ListSortFlags, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpListVal(val ...Value) *Expression
- func ExpListValueVal(val ...any) *Expression
- func ExpMapBin(name string) *Expression
- func ExpMapClear(bin *Expression, ctx ...*CDTContext) *Expression
- func ExpMapGetByIndex(returnType MapReturnTypes, valueType ExpType, index *Expression, ...) *Expression
- func ExpMapGetByIndexRange(returnType MapReturnTypes, index *Expression, bin *Expression, ...) *Expression
- func ExpMapGetByIndexRangeCount(returnType MapReturnTypes, index *Expression, count *Expression, ...) *Expression
- func ExpMapGetByKey(returnType MapReturnTypes, valueType ExpType, key *Expression, bin *Expression, ...) *Expression
- func ExpMapGetByKeyList(returnType MapReturnTypes, keys *Expression, bin *Expression, ...) *Expression
- func ExpMapGetByKeyRange(returnType MapReturnTypes, keyBegin *Expression, keyEnd *Expression, ...) *Expression
- func ExpMapGetByKeyRelativeIndexRange(returnType MapReturnTypes, key *Expression, index *Expression, bin *Expression, ...) *Expression
- func ExpMapGetByKeyRelativeIndexRangeCount(returnType MapReturnTypes, key *Expression, index *Expression, ...) *Expression
- func ExpMapGetByRank(returnType MapReturnTypes, valueType ExpType, rank *Expression, ...) *Expression
- func ExpMapGetByRankRange(returnType MapReturnTypes, rank *Expression, bin *Expression, ...) *Expression
- func ExpMapGetByRankRangeCount(returnType MapReturnTypes, rank *Expression, count *Expression, ...) *Expression
- func ExpMapGetByValue(returnType MapReturnTypes, value *Expression, bin *Expression, ...) *Expression
- func ExpMapGetByValueList(returnType MapReturnTypes, values *Expression, bin *Expression, ...) *Expression
- func ExpMapGetByValueRange(returnType MapReturnTypes, valueBegin *Expression, valueEnd *Expression, ...) *Expression
- func ExpMapGetByValueRelativeRankRange(returnType MapReturnTypes, value *Expression, rank *Expression, ...) *Expression
- func ExpMapGetByValueRelativeRankRangeCount(returnType MapReturnTypes, value *Expression, rank *Expression, ...) *Expression
- func ExpMapIncrement(policy *MapPolicy, key *Expression, incr *Expression, bin *Expression, ...) *Expression
- func ExpMapKeys(mapExp *Expression) *Expression
- func ExpMapLoopVar(part LoopVarPart) *Expression
- func ExpMapPut(policy *MapPolicy, key *Expression, value *Expression, bin *Expression, ...) *Expression
- func ExpMapPutItems(policy *MapPolicy, amap *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpMapRemoveByIndex(index *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpMapRemoveByIndexRange(returnType MapReturnTypes, index *Expression, bin *Expression, ...) *Expression
- func ExpMapRemoveByIndexRangeCount(returnType MapReturnTypes, index *Expression, count *Expression, ...) *Expression
- func ExpMapRemoveByKey(key *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpMapRemoveByKeyList(returnType MapReturnTypes, keys *Expression, bin *Expression, ...) *Expression
- func ExpMapRemoveByKeyRange(returnType MapReturnTypes, keyBegin *Expression, keyEnd *Expression, ...) *Expression
- func ExpMapRemoveByKeyRelativeIndexRange(returnType MapReturnTypes, key *Expression, index *Expression, bin *Expression, ...) *Expression
- func ExpMapRemoveByKeyRelativeIndexRangeCount(returnType MapReturnTypes, key *Expression, index *Expression, ...) *Expression
- func ExpMapRemoveByRank(rank *Expression, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpMapRemoveByRankRange(returnType MapReturnTypes, rank *Expression, bin *Expression, ...) *Expression
- func ExpMapRemoveByRankRangeCount(returnType MapReturnTypes, rank *Expression, count *Expression, ...) *Expression
- func ExpMapRemoveByValue(returnType MapReturnTypes, value *Expression, bin *Expression, ...) *Expression
- func ExpMapRemoveByValueList(returnType MapReturnTypes, values *Expression, bin *Expression, ...) *Expression
- func ExpMapRemoveByValueRange(returnType MapReturnTypes, valueBegin *Expression, valueEnd *Expression, ...) *Expression
- func ExpMapRemoveByValueRelativeRankRange(returnType MapReturnTypes, value *Expression, rank *Expression, ...) *Expression
- func ExpMapRemoveByValueRelativeRankRangeCount(returnType MapReturnTypes, value *Expression, rank *Expression, ...) *Expression
- func ExpMapSize(bin *Expression, ctx ...*CDTContext) *Expression
- func ExpMapVal(val MapValue) *Expression
- func ExpMapValues(mapExp *Expression) *Expression
- func ExpMax(exps ...*Expression) *Expression
- func ExpMemorySize() *Expressiondeprecated
- func ExpMin(exps ...*Expression) *Expression
- func ExpModifyByPath(returnType ExpType, flag ModifyFlag, bin *Expression, modifyExp *Expression, ...) *Expression
- func ExpNilLoopVar(part LoopVarPart) *Expression
- func ExpNilValue() *Expression
- func ExpNot(exp *Expression) *Expression
- func ExpNotEq(left *Expression, right *Expression) *Expression
- func ExpNumAbs(value *Expression) *Expression
- func ExpNumAdd(exps ...*Expression) *Expression
- func ExpNumCeil(num *Expression) *Expression
- func ExpNumDiv(exps ...*Expression) *Expression
- func ExpNumFloor(num *Expression) *Expression
- func ExpNumLog(num *Expression, base *Expression) *Expression
- func ExpNumMod(numerator *Expression, denominator *Expression) *Expression
- func ExpNumMul(exps ...*Expression) *Expression
- func ExpNumPow(base *Expression, exponent *Expression) *Expression
- func ExpNumSub(exps ...*Expression) *Expression
- func ExpOr(exps ...*Expression) *Expression
- func ExpRecordSize() *Expression
- func ExpRegexCompare(regex string, flags ExpRegexFlags, bin *Expression) *Expressiondeprecated
- func ExpRemoveResult() *Expression
- func ExpSelectByPath(returnType ExpType, flag SelectFlag, bin *Expression, ctx ...*CDTContext) *Expression
- func ExpSetName() *Expression
- func ExpSinceUpdate() *Expression
- func ExpStringAppend(policy *StringPolicy, src *Expression, value *Expression) *Expression
- func ExpStringB64Decode(src *Expression) *Expression
- func ExpStringBin(name string) *Expression
- func ExpStringByteLength(src *Expression) *Expression
- func ExpStringCaseFold(policy *StringPolicy, src *Expression) *Expression
- func ExpStringCharAt(src *Expression, index *Expression) *Expression
- func ExpStringConcat(policy *StringPolicy, src *Expression, values *Expression) *Expression
- func ExpStringContains(src *Expression, needle *Expression) *Expression
- func ExpStringEndsWith(src *Expression, suffix *Expression) *Expression
- func ExpStringFind(src *Expression, needle *Expression) *Expression
- func ExpStringFindNth(src *Expression, needle *Expression, occurrence *Expression) *Expression
- func ExpStringInsert(policy *StringPolicy, src *Expression, index *Expression, value *Expression) *Expression
- func ExpStringIsLower(src *Expression) *Expression
- func ExpStringIsNumeric(src *Expression) *Expression
- func ExpStringIsNumericTyped(src *Expression, numericType StringNumericType) *Expression
- func ExpStringIsUpper(src *Expression) *Expression
- func ExpStringLen(src *Expression) *Expression
- func ExpStringLoopVar(part LoopVarPart) *Expression
- func ExpStringLower(policy *StringPolicy, src *Expression) *Expression
- func ExpStringNormalizeNFC(policy *StringPolicy, src *Expression) *Expression
- func ExpStringOverwrite(policy *StringPolicy, src *Expression, index *Expression, value *Expression) *Expression
- func ExpStringPadEnd(policy *StringPolicy, src *Expression, targetLength *Expression, ...) *Expression
- func ExpStringPadStart(policy *StringPolicy, src *Expression, targetLength *Expression, ...) *Expression
- func ExpStringPrepend(policy *StringPolicy, src *Expression, value *Expression) *Expression
- func ExpStringRegexCompare(src *Expression, pattern *Expression) *Expression
- func ExpStringRegexCompareWithFlags(src *Expression, pattern *Expression, regexFlags StringRegexFlags) *Expression
- func ExpStringRegexReplace(policy *StringPolicy, src *Expression, pattern *Expression, ...) *Expression
- func ExpStringRepeat(policy *StringPolicy, src *Expression, count *Expression) *Expression
- func ExpStringReplace(policy *StringPolicy, src *Expression, needle *Expression, ...) *Expression
- func ExpStringReplaceAll(policy *StringPolicy, src *Expression, needle *Expression, ...) *Expression
- func ExpStringSnip(policy *StringPolicy, src *Expression, start *Expression, end *Expression) *Expression
- func ExpStringSnipFrom(policy *StringPolicy, src *Expression, start *Expression) *Expression
- func ExpStringSplit(src *Expression) *Expression
- func ExpStringSplitBySeparator(src *Expression, separator *Expression) *Expression
- func ExpStringStartsWith(src *Expression, prefix *Expression) *Expression
- func ExpStringSubstr(src *Expression, start *Expression, end *Expression) *Expression
- func ExpStringSubstrFrom(src *Expression, start *Expression) *Expression
- func ExpStringToBlob(src *Expression) *Expression
- func ExpStringToDouble(src *Expression) *Expression
- func ExpStringToInteger(src *Expression) *Expression
- func ExpStringToString(src *Expression) *Expression
- func ExpStringTrim(policy *StringPolicy, src *Expression) *Expression
- func ExpStringTrimEnd(policy *StringPolicy, src *Expression) *Expression
- func ExpStringTrimStart(policy *StringPolicy, src *Expression) *Expression
- func ExpStringUpper(policy *StringPolicy, src *Expression) *Expression
- func ExpStringVal(val string) *Expression
- func ExpTTL() *Expression
- func ExpToFloat(num *Expression) *Expression
- func ExpToInt(num *Expression) *Expression
- func ExpUnknown() *Expression
- func ExpValueArrayVal(val ValueArray) *Expression
- func ExpVar(name string) *Expression
- func ExpVoidTime() *Expression
- func ExpWildCardValue() *Expression
- type ExpressionArgument
- type ExpressionTrace
- type FieldType
- type Filter
- func NewContainsFilter(binName string, indexCollectionType IndexCollectionType, value any, ...) *Filter
- func NewContainsRangeFilter(binName string, indexCollectionType IndexCollectionType, begin, end int64, ...) *Filter
- func NewContainsRangeWithExpressionFilter(expression *Expression, collectionType IndexCollectionType, begin, end int64) *Filter
- func NewContainsRangeWithIndexNameFilter(indexName string, collectionType IndexCollectionType, begin, end int64) *Filter
- func NewContainsWithExpressionFilter(expression *Expression, indexCollectionType IndexCollectionType, value any) *Filter
- func NewContainsWithIndexNameFilter(indexName string, indexCollectionType IndexCollectionType, value any) *Filter
- func NewEqualFilter(binName string, value any, ctx ...*CDTContext) *Filter
- func NewEqualWithExpressionFilter(expression *Expression, value any) *Filter
- func NewEqualWithIndexNameFilter(indexName string, value any) *Filter
- func NewFilter(name string, indexCollectionType IndexCollectionType, valueParticleType int, ...) *Filter
- func NewGeoRegionsContainingPointFilter(binName, point string, ctx ...*CDTContext) *Filter
- func NewGeoRegionsContainingPointForCollectionFilter(binName string, collectionType IndexCollectionType, point string, ...) *Filter
- func NewGeoRegionsContainingPointForCollectionWithExpressionFilter(expression *Expression, collectionType IndexCollectionType, point string) *Filter
- func NewGeoRegionsContainingPointForCollectionWithIndexNameFilter(indexName string, collectionType IndexCollectionType, point string) *Filter
- func NewGeoRegionsContainingPointWithExpressionFilter(expression *Expression, point string) *Filter
- func NewGeoRegionsContainingPointWithIndexNameFilter(indexName string, point string) *Filter
- func NewGeoWithinRadiusFilter(binName string, lng, lat, radius float64, ctx ...*CDTContext) *Filter
- func NewGeoWithinRadiusForCollectionFilter(binName string, collectionType IndexCollectionType, lng, lat, radius float64, ...) *Filter
- func NewGeoWithinRadiusForCollectionWithExpressionFilter(expression *Expression, collectionType IndexCollectionType, ...) *Filter
- func NewGeoWithinRadiusForCollectionWithIndexNameFilter(indexName string, collectionType IndexCollectionType, lng, lat, radius float64) *Filter
- func NewGeoWithinRadiusWithExpressionFilter(expression *Expression, lng, lat, radius float64) *Filter
- func NewGeoWithinRadiusWithIndexNameFilter(indexName string, lng, lat, radius float64) *Filter
- func NewGeoWithinRegionFilter(binName, region string, ctx ...*CDTContext) *Filter
- func NewGeoWithinRegionForCollectionFilter(binName string, collectionType IndexCollectionType, region string, ...) *Filter
- func NewGeoWithinRegionForCollectionWithExpressionFilter(expression *Expression, collectionType IndexCollectionType, region string) *Filter
- func NewGeoWithinRegionForCollectionWithIndexNameFilter(indexName string, collectionType IndexCollectionType, region string) *Filter
- func NewGeoWithinRegionWithExpressionFilter(expression *Expression, region string) *Filter
- func NewGeoWithinRegionWithIndexNameFilter(indexName string, region string) *Filter
- func NewRangeFilter(binName string, begin int64, end int64, ctx ...*CDTContext) *Filter
- func NewRangeWithExpressionFilter(expression *Expression, begin int64, end int64) *Filter
- func NewRangeWithIndexNameFilter(indexName string, begin int64, end int64) *Filter
- func NewWithExpressionFilter(expression *Expression, indexCollectionType IndexCollectionType, ...) *Filter
- func NewWithIndexNameFilter(indexName string, indexCollectionType IndexCollectionType, ...) *Filter
- type FloatValue
- type GenerationPolicy
- type GeoJSONValue
- type HLLPolicy
- type HLLValue
- type Host
- type IndexCollectionType
- type IndexTask
- type IndexType
- type InfinityValue
- type InfoPolicy
- type IntegerValue
- type JsonValue
- type Key
- func (ky *Key) Digest() []byte
- func (ky *Key) Equals(other *Key) bool
- func (ky *Key) Namespace() string
- func (ky *Key) PartitionId() int
- func (ky *Key) SetDigest(digest []byte) Error
- func (ky *Key) SetName() string
- func (ky *Key) SetValue(val Value) Error
- func (ky *Key) String() string
- func (ky *Key) Value() Value
- type Labels
- type Language
- type ListIter
- type ListOrderType
- type ListPolicy
- type ListReturnType
- type ListSortFlags
- type ListValue
- type ListerValue
- type LongValue
- type LoopVarPart
- type MapIter
- type MapOrderTypes
- type MapPair
- type MapPolicy
- type MapReturnTypes
- type MapValue
- type MapWriteModes
- type MapperValue
- type MetricsPolicy
- type ModifyFlag
- type MultiPolicy
- type Node
- func (nd *Node) Close()
- func (nd *Node) Equals(other *Node) bool
- func (nd *Node) GetAliases() []*Host
- func (nd *Node) GetConnection(timeout time.Duration) (conn *Connection, err Error)
- func (nd *Node) GetHost() *Host
- func (nd *Node) GetName() string
- func (nd *Node) GetServerVersion() version.Version
- func (nd *Node) InvalidateConnection(conn *Connection)
- func (nd *Node) IsActive() bool
- func (nd *Node) MigrationInProgress() (bool, Error)
- func (nd *Node) PartitionGeneration() int
- func (nd *Node) PeersGeneration() int
- func (nd *Node) PutConnection(conn *Connection)
- func (nd *Node) Rack(namespace string) (int, Error)
- func (nd *Node) RebalanceGeneration() int
- func (nd *Node) Refresh(peers *peers) Error
- func (nd *Node) RequestInfo(policy *InfoPolicy, name ...string) (map[string]string, Error)
- func (nd *Node) RequestStats(policy *InfoPolicy) (map[string]string, Error)
- func (nd *Node) String() string
- func (nd *Node) SupportsBatchAny() bool
- func (nd *Node) SupportsPartitionQuery() bool
- func (nd *Node) SupportsQueryOpsProjectionExt() bool
- func (nd *Node) SupportsQueryShow() bool
- func (nd *Node) WaitUntillMigrationIsFinished(timeout time.Duration) Error
- func (nd *Node) WarmUp(count int) (int, Error)
- type NullValue
- type OpResults
- type Operation
- func AddOp(bin *Bin) *Operation
- func AppendOp(bin *Bin) *Operationdeprecated
- func BitAddOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value int64, ...) *Operation
- func BitAndOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value []byte, ...) *Operation
- func BitB64EncodeOp(binName string, ctx ...*CDTContext) *Operation
- func BitB64EncodeRangeOp(binName string, byteOffset int, byteSize int, invertSize bool, ...) *Operation
- func BitCountOp(binName string, bitOffset int, bitSize int, ctx ...*CDTContext) *Operation
- func BitGetIntOp(binName string, bitOffset int, bitSize int, signed bool, ctx ...*CDTContext) *Operation
- func BitGetOp(binName string, bitOffset int, bitSize int, ctx ...*CDTContext) *Operation
- func BitInsertOp(policy *BitPolicy, binName string, byteOffset int, value []byte, ...) *Operation
- func BitLScanOp(binName string, bitOffset int, bitSize int, value bool, ctx ...*CDTContext) *Operation
- func BitLShiftOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, shift int, ...) *Operation
- func BitNotOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, ...) *Operation
- func BitOrOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value []byte, ...) *Operation
- func BitRScanOp(binName string, bitOffset int, bitSize int, value bool, ctx ...*CDTContext) *Operation
- func BitRShiftOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, shift int, ...) *Operation
- func BitRemoveOp(policy *BitPolicy, binName string, byteOffset int, byteSize int, ...) *Operation
- func BitResizeOp(policy *BitPolicy, binName string, byteSize int, resizeFlags BitResizeFlags, ...) *Operation
- func BitSetIntOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value int64, ...) *Operation
- func BitSetOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value []byte, ...) *Operation
- func BitSubtractOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value int64, ...) *Operation
- func BitXorOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value []byte, ...) *Operation
- func DeleteOp() *Operation
- func ExpReadOp(name string, exp *Expression, flags ExpReadFlags) *Operation
- func ExpWriteOp(binName string, exp *Expression, flags ExpWriteFlags) *Operation
- func GetBinOp(binName string) *Operation
- func GetHeaderOp() *Operation
- func GetOp() *Operation
- func HLLAddOp(policy *HLLPolicy, binName string, list []Value, ...) *Operation
- func HLLDescribeOp(binName string) *Operation
- func HLLFoldOp(binName string, indexBitCount int) *Operation
- func HLLGetCountOp(binName string) *Operation
- func HLLGetIntersectCountOp(binName string, list []HLLValue) *Operation
- func HLLGetSimilarityOp(binName string, list []HLLValue) *Operation
- func HLLGetUnionCountOp(binName string, list []HLLValue) *Operation
- func HLLGetUnionOp(binName string, list []HLLValue) *Operation
- func HLLInitOp(policy *HLLPolicy, binName string, indexBitCount, minHashBitCount int) *Operation
- func HLLRefreshCountOp(binName string) *Operation
- func HLLSetUnionOp(policy *HLLPolicy, binName string, list []HLLValue) *Operation
- func ListAppendOp(binName string, values ...interface{}) *Operation
- func ListAppendWithPolicyContextOp(policy *ListPolicy, binName string, ctx []*CDTContext, values ...any) *Operation
- func ListAppendWithPolicyOp(policy *ListPolicy, binName string, values ...any) *Operation
- func ListClearOp(binName string, ctx ...*CDTContext) *Operation
- func ListCreateOp(binName string, listOrder ListOrderType, pad bool, ctx ...*CDTContext) *Operation
- func ListCreateWithIndexOp(binName string, listOrder ListOrderType, pad bool, ctx ...*CDTContext) *Operation
- func ListGetByIndexOp(binName string, index int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListGetByIndexRangeCountOp(binName string, index, count int, returnType ListReturnType, ...) *Operation
- func ListGetByIndexRangeOp(binName string, index int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListGetByRankOp(binName string, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListGetByRankRangeCountOp(binName string, rank, count int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListGetByRankRangeOp(binName string, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListGetByValueListOp(binName string, values []any, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListGetByValueOp(binName string, value interface{}, returnType ListReturnType, ...) *Operation
- func ListGetByValueRangeOp(binName string, beginValue, endValue interface{}, returnType ListReturnType, ...) *Operation
- func ListGetByValueRelativeRankRangeCountOp(binName string, value any, rank, count int, returnType ListReturnType, ...) *Operation
- func ListGetByValueRelativeRankRangeOp(binName string, value any, rank int, returnType ListReturnType, ...) *Operation
- func ListGetOp(binName string, index int, ctx ...*CDTContext) *Operation
- func ListGetRangeFromOp(binName string, index int, ctx ...*CDTContext) *Operation
- func ListGetRangeOp(binName string, index int, count int, ctx ...*CDTContext) *Operation
- func ListIncrementByOneOp(binName string, index int, ctx ...*CDTContext) *Operation
- func ListIncrementByOneWithPolicyOp(policy *ListPolicy, binName string, index int, ctx ...*CDTContext) *Operation
- func ListIncrementOp(binName string, index int, value any, ctx ...*CDTContext) *Operation
- func ListIncrementWithPolicyOp(policy *ListPolicy, binName string, index int, value any, ctx ...*CDTContext) *Operation
- func ListInsertOp(binName string, index int, values ...interface{}) *Operation
- func ListInsertWithPolicyContextOp(policy *ListPolicy, binName string, index int, ctx []*CDTContext, ...) *Operation
- func ListInsertWithPolicyOp(policy *ListPolicy, binName string, index int, values ...any) *Operation
- func ListJoinBySeparatorOp(binName string, separator string, ctx ...*CDTContext) *Operation
- func ListJoinOp(binName string, ctx ...*CDTContext) *Operation
- func ListPopOp(binName string, index int, ctx ...*CDTContext) *Operation
- func ListPopRangeFromOp(binName string, index int, ctx ...*CDTContext) *Operation
- func ListPopRangeOp(binName string, index int, count int, ctx ...*CDTContext) *Operation
- func ListRemoveByIndexOp(binName string, index int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListRemoveByIndexRangeCountOp(binName string, index, count int, returnType ListReturnType, ...) *Operation
- func ListRemoveByIndexRangeOp(binName string, index int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListRemoveByRankOp(binName string, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListRemoveByRankRangeCountOp(binName string, rank int, count int, returnType ListReturnType, ...) *Operation
- func ListRemoveByRankRangeOp(binName string, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListRemoveByValueListOp(binName string, values []any, returnType ListReturnType, ctx ...*CDTContext) *Operation
- func ListRemoveByValueOp(binName string, value interface{}, returnType ListReturnType, ...) *Operation
- func ListRemoveByValueRangeOp(binName string, returnType ListReturnType, valueBegin, valueEnd any, ...) *Operation
- func ListRemoveByValueRelativeRankRangeCountOp(binName string, returnType ListReturnType, value any, rank, count int, ...) *Operation
- func ListRemoveByValueRelativeRankRangeOp(binName string, returnType ListReturnType, value any, rank int, ...) *Operation
- func ListRemoveOp(binName string, index int, ctx ...*CDTContext) *Operation
- func ListRemoveRangeFromOp(binName string, index int, ctx ...*CDTContext) *Operation
- func ListRemoveRangeOp(binName string, index int, count int, ctx ...*CDTContext) *Operation
- func ListSetOp(binName string, index int, value interface{}, ctx ...*CDTContext) *Operation
- func ListSetOrderOp(binName string, listOrder ListOrderType, ctx ...*CDTContext) *Operation
- func ListSetOrderWithIndexOp(binName string, listOrder ListOrderType, ctx ...*CDTContext) *Operation
- func ListSetWithPolicyOp(policy *ListPolicy, binName string, index int, value any, ctx ...*CDTContext) *Operation
- func ListSizeOp(binName string, ctx ...*CDTContext) *Operation
- func ListSortOp(binName string, sortFlags ListSortFlags, ctx ...*CDTContext) *Operation
- func ListTrimOp(binName string, index int, count int, ctx ...*CDTContext) *Operation
- func MapClearOp(binName string, ctx ...*CDTContext) *Operation
- func MapCreateOp(binName string, order mapOrderType, ctx []*CDTContext) *Operation
- func MapCreateWithIndexOp(binName string, order mapOrderType) *Operation
- func MapDecrementOp(policy *MapPolicy, binName string, key any, decr any, ctx ...*CDTContext) *Operation
- func MapGetByIndexOp(binName string, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapGetByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType, ...) *Operation
- func MapGetByIndexRangeOp(binName string, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapGetByKeyListOp(binName string, keys []interface{}, returnType mapReturnType, ...) *Operation
- func MapGetByKeyOp(binName string, key interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapGetByKeyRangeOp(binName string, keyBegin interface{}, keyEnd interface{}, ...) *Operation
- func MapGetByKeyRelativeIndexRangeCountOp(binName string, key any, index, count int, returnType mapReturnType, ...) *Operation
- func MapGetByKeyRelativeIndexRangeOp(binName string, key any, index int, returnType mapReturnType, ...) *Operation
- func MapGetByRankOp(binName string, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapGetByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType, ...) *Operation
- func MapGetByRankRangeOp(binName string, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapGetByValueListOp(binName string, values []any, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapGetByValueOp(binName string, value interface{}, returnType mapReturnType, ...) *Operation
- func MapGetByValueRangeOp(binName string, valueBegin interface{}, valueEnd interface{}, ...) *Operation
- func MapGetByValueRelativeRankRangeCountOp(binName string, value any, rank, count int, returnType mapReturnType, ...) *Operation
- func MapGetByValueRelativeRankRangeOp(binName string, value any, rank int, returnType mapReturnType, ...) *Operation
- func MapIncrementOp(policy *MapPolicy, binName string, key interface{}, incr interface{}, ...) *Operation
- func MapPutItemsOp(policy *MapPolicy, binName string, amap map[interface{}]interface{}, ...) *Operation
- func MapPutOp(policy *MapPolicy, binName string, key interface{}, value interface{}, ...) *Operation
- func MapRemoveByIndexOp(binName string, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapRemoveByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType, ...) *Operation
- func MapRemoveByIndexRangeOp(binName string, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapRemoveByKeyListOp(binName string, keys []any, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapRemoveByKeyOp(binName string, key interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapRemoveByKeyRangeOp(binName string, keyBegin any, keyEnd any, returnType mapReturnType, ...) *Operation
- func MapRemoveByKeyRelativeIndexRangeCountOp(binName string, key any, index, count int, returnType mapReturnType, ...) *Operation
- func MapRemoveByKeyRelativeIndexRangeOp(binName string, key any, index int, returnType mapReturnType, ...) *Operation
- func MapRemoveByRankOp(binName string, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapRemoveByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType, ...) *Operation
- func MapRemoveByRankRangeOp(binName string, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapRemoveByValueListOp(binName string, values []any, returnType mapReturnType, ctx ...*CDTContext) *Operation
- func MapRemoveByValueOp(binName string, value interface{}, returnType mapReturnType, ...) *Operation
- func MapRemoveByValueRangeOp(binName string, valueBegin any, valueEnd any, returnType mapReturnType, ...) *Operation
- func MapRemoveByValueRelativeRankRangeCountOp(binName string, value any, rank, count int, returnType mapReturnType, ...) *Operation
- func MapRemoveByValueRelativeRankRangeOp(binName string, value any, rank int, returnType mapReturnType, ...) *Operation
- func MapSetPolicyOp(policy *MapPolicy, binName string, ctx ...*CDTContext) *Operation
- func MapSizeOp(binName string, ctx ...*CDTContext) *Operation
- func ModifyByPath(binName string, flag ModifyFlag, modifyExp *Expression, ctx ...*CDTContext) *Operation
- func PrependOp(bin *Bin) *Operationdeprecated
- func PutOp(bin *Bin) *Operation
- func SelectByPath(binName string, flag SelectFlag, ctx ...*CDTContext) *Operation
- func StrAppendOp(policy *StringPolicy, binName string, value string, ctx ...*CDTContext) *Operation
- func StrB64DecodeOp(binName string, ctx ...*CDTContext) *Operation
- func StrByteLengthOp(binName string, ctx ...*CDTContext) *Operation
- func StrCaseFoldOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
- func StrCharAtOp(binName string, index int, ctx ...*CDTContext) *Operation
- func StrConcatListOp(policy *StringPolicy, binName string, values []string, ctx ...*CDTContext) *Operation
- func StrConcatOp(policy *StringPolicy, binName string, value string, ctx ...*CDTContext) *Operation
- func StrContainsOp(binName string, needle string, ctx ...*CDTContext) *Operation
- func StrEndsWithOp(binName string, suffix string, ctx ...*CDTContext) *Operation
- func StrFindNthOp(binName string, needle string, occurrence int, ctx ...*CDTContext) *Operation
- func StrFindOp(binName string, needle string, ctx ...*CDTContext) *Operation
- func StrInsertOp(policy *StringPolicy, binName string, index int, value string, ...) *Operation
- func StrIsLowerOp(binName string, ctx ...*CDTContext) *Operation
- func StrIsNumericOp(binName string, ctx ...*CDTContext) *Operation
- func StrIsNumericTypedOp(binName string, numericType StringNumericType, ctx ...*CDTContext) *Operation
- func StrIsUpperOp(binName string, ctx ...*CDTContext) *Operation
- func StrLenOp(binName string, ctx ...*CDTContext) *Operation
- func StrLowerOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
- func StrNormalizeNFCOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
- func StrOverwriteOp(policy *StringPolicy, binName string, index int, value string, ...) *Operation
- func StrPadEndOp(policy *StringPolicy, binName string, targetLength int, padString string, ...) *Operation
- func StrPadStartOp(policy *StringPolicy, binName string, targetLength int, padString string, ...) *Operation
- func StrPrependOp(policy *StringPolicy, binName string, value string, ctx ...*CDTContext) *Operation
- func StrRegexCompareOp(binName string, pattern string, ctx ...*CDTContext) *Operation
- func StrRegexCompareWithFlagsOp(binName string, pattern string, regexFlags StringRegexFlags, ...) *Operation
- func StrRegexReplaceOp(policy *StringPolicy, binName string, pattern string, replacement string, ...) *Operation
- func StrRepeatOp(policy *StringPolicy, binName string, count int, ctx ...*CDTContext) *Operation
- func StrReplaceAllOp(policy *StringPolicy, binName string, needle string, replacement string, ...) *Operation
- func StrReplaceOp(policy *StringPolicy, binName string, needle string, replacement string, ...) *Operation
- func StrSnipFromOp(policy *StringPolicy, binName string, start int, ctx ...*CDTContext) *Operation
- func StrSnipOp(policy *StringPolicy, binName string, start int, end int, ctx ...*CDTContext) *Operation
- func StrSplitBySeparatorOp(binName string, separator string, ctx ...*CDTContext) *Operation
- func StrSplitOp(binName string, ctx ...*CDTContext) *Operation
- func StrStartsWithOp(binName string, prefix string, ctx ...*CDTContext) *Operation
- func StrSubstrFromOp(binName string, start int, ctx ...*CDTContext) *Operation
- func StrSubstrOp(binName string, start int, end int, ctx ...*CDTContext) *Operation
- func StrToBlobOp(binName string, ctx ...*CDTContext) *Operation
- func StrToDoubleOp(binName string, ctx ...*CDTContext) *Operation
- func StrToIntegerOp(binName string, ctx ...*CDTContext) *Operation
- func StrToStringOp(binName string) *Operation
- func StrTrimEndOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
- func StrTrimOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
- func StrTrimStartOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
- func StrUpperOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
- func TouchOp() *Operation
- type OperationType
- type Partition
- func (ptn *Partition) Equals(other *Partition) bool
- func (ptn *Partition) GetNodeQuery(cluster *Cluster, partitions *Partitions, ps *PartitionStatus) (*Node, Error)
- func (ptn *Partition) GetNodeRead(cluster *Cluster) (*Node, Error)
- func (ptn *Partition) GetNodeWrite(cluster *Cluster) (*Node, Error)
- func (ptn *Partition) PrepareRetryRead(isClientTimeout bool)
- func (ptn *Partition) PrepareRetryWrite(isClientTimeout bool)
- func (ptn *Partition) String() string
- type PartitionFilter
- func NewPartitionFilterAll() *PartitionFilter
- func NewPartitionFilterById(partitionId int) *PartitionFilter
- func NewPartitionFilterByKey(key *Key) *PartitionFilter
- func NewPartitionFilterByRange(begin, count int) *PartitionFilter
- func NewPartitionFilterSelectPartitions(partitionIds []int) (*PartitionFilter, error)
- type PartitionStatus
- type Partitions
- type Policy
- type Privilege
- type QueryDuration
- type QueryPolicy
- type RawBlobValue
- type ReadModeAP
- type ReadModeSC
- type Record
- type RecordExistsAction
- type Recordset
- type RegisterTask
- type RemoveTask
- type ReplicaPolicy
- type Result
- type Role
- type ScanPolicy
- type SelectFlag
- type Statement
- type StringNumericType
- type StringPolicy
- type StringRegexFlags
- type StringValue
- type StringWriteFlags
- type Task
- type Txn
- func (txn *Txn) Clear()
- func (txn *Txn) CloseMonitor() bool
- func (txn *Txn) GetInDoubt() bool
- func (txn *Txn) GetNamespace() *string
- func (txn *Txn) GetReadVersion(key *Key) *uint64
- func (txn *Txn) GetReads() map[*Key]*uint64
- func (txn *Txn) GetTimeout() time.Duration
- func (txn *Txn) GetWrites() []*Key
- func (txn *Txn) Id() int64
- func (txn *Txn) MonitorExists() bool
- func (txn *Txn) OnRead(key *Key, version *uint64)
- func (txn *Txn) OnWrite(key *Key, version *uint64, resultCode types.ResultCode)
- func (txn *Txn) OnWriteInDoubt(key *Key)
- func (txn *Txn) ReadExistsForKey(key *Key) bool
- func (txn *Txn) SetInDoubt(inDoubt bool)
- func (txn *Txn) SetNamespace(ns string) Error
- func (txn *Txn) SetState(state TxnState)
- func (txn *Txn) SetTimeout(timeout time.Duration)
- func (txn *Txn) State() TxnState
- func (txn *Txn) VerifyCommand() Error
- func (txn *Txn) WriteExistsForKey(key *Key) bool
- type TxnError
- type TxnMonitor
- type TxnRoll
- func (txr *TxnRoll) Abort(rollPolicy *BatchPolicy) (AbortStatus, Error)
- func (txr *TxnRoll) Close(writePolicy *WritePolicy, txnKey *Key) Error
- func (txr *TxnRoll) Commit(rollPolicy *BatchPolicy) (CommitStatus, Error)
- func (txr *TxnRoll) MarkRollForward(writePolicy *WritePolicy, txnKey *Key) Error
- func (txr *TxnRoll) Roll(rollPolicy *BatchPolicy, txnAttr int) Error
- func (txr *TxnRoll) Verify(verifyPolicy, rollPolicy *BatchPolicy) Error
- func (txr *TxnRoll) VerifyRecordVersions(verifyPolicy *BatchPolicy) Error
- type TxnRollPolicy
- type TxnState
- type TxnVerifyPolicy
- type UDF
- type UserRoles
- type Value
- type ValueArray
- type WildCardValue
- type WritePolicy
Examples ¶
- Client.Add
- Client.Append
- CtxListIndex
- CtxListRank
- CtxListValue
- CtxMapIndex
- CtxMapKey
- CtxMapRank
- ListAppendOp
- ListAppendWithPolicyContextOp
- ListClearOp
- ListGetByIndexOp
- ListGetByIndexRangeOp
- ListGetByRankOp
- ListGetByRankRangeOp
- ListGetByValueOp
- ListGetByValueRangeOp
- ListGetOp
- ListGetRangeOp
- ListInsertOp
- ListIter (Int)
- ListIter (String)
- ListIter (Time)
- ListPopOp
- ListRemoveByValueOp
- ListRemoveOp
- ListSetOp
- ListSizeOp
- MapClearOp
- MapGetByIndexOp
- MapGetByIndexRangeOp
- MapGetByKeyListOp
- MapGetByKeyOp
- MapGetByKeyRangeOp
- MapGetByRankOp
- MapGetByRankRangeCountOp
- MapGetByValueOp
- MapGetByValueRangeOp
- MapIncrementOp
- MapIter
- MapPutItemsOp
- MapPutOp
- MapRemoveByKeyOp
- MapRemoveByValueOp
- MapSizeOp
- PartitionFilter.EncodeCursor
Constants ¶
const ( // BitWriteFlagsDefault allows create or update. BitWriteFlagsDefault = 0 // BitWriteFlagsCreateOnly specifies that: // If the bin already exists, the operation will be denied. // If the bin does not exist, a new bin will be created. BitWriteFlagsCreateOnly = 1 // BitWriteFlagsUpdateOnly specifies that: // If the bin already exists, the bin will be overwritten. // If the bin does not exist, the operation will be denied. BitWriteFlagsUpdateOnly = 2 // BitWriteFlagsNoFail specifies not to raise error if operation is denied. BitWriteFlagsNoFail = 4 // BitWriteFlagsPartial allows other valid operations to be committed if this operations is // denied due to flag constraints. BitWriteFlagsPartial = 8 )
const ( // ListWriteFlagsDefault is the default behavior. It means: Allow duplicate values and insertions at any index. ListWriteFlagsDefault = 0 // ListWriteFlagsAddUnique means: Only add unique values. ListWriteFlagsAddUnique = 1 // ListWriteFlagsInsertBounded means: Enforce list boundaries when inserting. Do not allow values to be inserted // at index outside current list boundaries. ListWriteFlagsInsertBounded = 2 // ListWriteFlagsNoFail means: do not raise error if a list item fails due to write flag constraints. ListWriteFlagsNoFail = 4 // ListWriteFlagsPartial means: allow other valid list items to be committed if a list item fails due to // write flag constraints. ListWriteFlagsPartial = 8 )
const ( // MapWriteFlagsDefault is the Default. Allow create or update. MapWriteFlagsDefault = 0 // MapWriteFlagsCreateOnly means: If the key already exists, the item will be denied. // If the key does not exist, a new item will be created. MapWriteFlagsCreateOnly = 1 // MapWriteFlagsUpdateOnly means: If the key already exists, the item will be overwritten. // If the key does not exist, the item will be denied. MapWriteFlagsUpdateOnly = 2 // MapWriteFlagsNoFail means: Do not raise error if a map item is denied due to write flag constraints. MapWriteFlagsNoFail = 4 // MapWriteFlagsPartial means: Allow other valid map items to be committed if a map item is denied due to // write flag constraints. MapWriteFlagsPartial = 8 )
*
- Map write bit flags.
- Requires server versions >= 4.3.
const ( // ExpTracePhaseBuild indicates the expression build failed. ExpTracePhaseBuild = 1 // ExpTracePhaseEval indicates expression evaluation failed. ExpTracePhaseEval = 2 // ExpTraceOutcomeFault indicates evaluation faulted. ExpTraceOutcomeFault = 1 // ExpTraceOutcomeFalse indicates the expression evaluated cleanly to FALSE - // the record was not matched, and nothing went wrong. ExpTraceOutcomeFalse = 2 // ExpTraceOutcomeAbsent indicates a referenced bin or key was absent. ExpTraceOutcomeAbsent = 3 // ExpTraceLangMsgpack is the msgpack source language (the implied default when // the lang key is absent). ExpTraceLangMsgpack = 1 // ExpTraceLangAel is the AEL DSL source language. ExpTraceLangAel = 2 // ExpTracePathTruncationSentinel is the "..." sentinel the server splices into // [ExpressionTrace.Path] when the true nesting depth exceeds the path-frame cap. // [ExpressionTrace.Depth] still reports the true count. ExpTracePathTruncationSentinel = "..." )
Expression-trace semantic constants surfaced to consumers.
const ( // HLLWriteFlagsDefault is Default. Allow create or update. HLLWriteFlagsDefault = 0 // HLLWriteFlagsCreateOnly behaves like the following: // If the bin already exists, the operation will be denied. // If the bin does not exist, a new bin will be created. HLLWriteFlagsCreateOnly = 1 // HLLWriteFlagsUpdateOnly behaves like the following: // If the bin already exists, the bin will be overwritten. // If the bin does not exist, the operation will be denied. HLLWriteFlagsUpdateOnly = 2 // HLLWriteFlagsNoFail does not raise error if operation is denied. HLLWriteFlagsNoFail = 4 // HLLWriteFlagsAllowFold allows the resulting set to be the minimum of provided index bits. // Also, allow the usage of less precise HLL algorithms when minHash bits // of all participating sets do not match. HLLWriteFlagsAllowFold = 8 )
const ( MAX_ERROR_RATE_MIN_VALUE = 100 ERROR_RATE_MIN_VALUE = 1 )
const ( // LONG specifies that the query is expected to return more than 100 records per node. The server optimizes for a large record set in // the following ways: // // Allow query to be run in multiple threads using the server's query threading configuration. // Do not relax read consistency for AP namespaces. // Add the query to the server's query monitor. // Do not add the overall latency to the server's latency histogram. // Do not allow server timeouts. LONG = iota // Short specifies that the query is expected to return less than 100 records per node. The server optimizes for a small record set in // the following ways: // Always run the query in one thread and ignore the server's query threading configuration. // Allow query to be inlined directly on the server's service thread. // Relax read consistency for AP namespaces. // Do not add the query to the server's query monitor. // Add the overall latency to the server's latency histogram. // Allow server timeouts. The default server timeout for a short query is 1 second. SHORT // LONG_RELAX_AP will treat query as a LONG query, but relax read consistency for AP namespaces. // This value is treated exactly like LONG for server versions < 7.1. LONG_RELAX_AP )
const ( // UserAdmin allows to manages users and their roles. UserAdmin privilegeCode = "user-admin" // SysAdmin allows to manage indexes, user defined functions and server configuration. SysAdmin privilegeCode = "sys-admin" // DataAdmin allows to manage indices and user defined functions. DataAdmin privilegeCode = "data-admin" // UDFAdmin allows to manage user defined functions. UDFAdmin privilegeCode = "udf-admin" // SIndexAdmin allows to manage indices. SIndexAdmin privilegeCode = "sindex-admin" // ReadWriteUDF allows read, write and UDF transactions with the database. ReadWriteUDF privilegeCode = "read-write-udf" // ReadWrite allows read and write transactions with the database. ReadWrite privilegeCode = "read-write" // Read allows read transactions with the database. Read privilegeCode = "read" // Write allows write transactions with the database. Write privilegeCode = "write" // Truncate allow issuing truncate commands. Truncate privilegeCode = "truncate" // MaskingAdmin allows to manage masking policies. Requires server version >= 8.1.1. MaskingAdmin privilegeCode = "masking-admin" // ReadMasked allows read transactions with the database with masking policies applied. Requires server version >= 8.1.1. ReadMasked privilegeCode = "read-masked" // WriteMasked allows write transactions with the database with masking policies applied. Requires server version >= 8.1.1. WriteMasked privilegeCode = "write-masked" )
Pre-defined user roles.
const ( // TTLServerDefault will default to namespace configuration variable "default-ttl" on the server. TTLServerDefault = 0 // TTLDontExpire will never expire for Aerospike 2 server versions >= 2.7.2 and Aerospike 3+ server. TTLDontExpire = math.MaxUint32 // TTLDontUpdate will not change the record's ttl when record is written. Supported by Aerospike server versions >= 3.10.1 TTLDontUpdate = math.MaxUint32 - 1 )
Variables ¶
var ( // DefaultBufferSize specifies the initial size of the connection buffer when it is created. // If not big enough (as big as the average record), it will be reallocated to size again // which will be more expensive. DefaultBufferSize = 64 * 1024 // 64 KiB // MaxBufferSize protects against allocating massive memory blocks // for buffers. Tweak this number if you are returning a lot of // large records in your requests. MaxBufferSize = 1024 * 1024 * 120 // 120 MiB // PoolCutOffBufferSize specifies the largest buffer size that will be pooled. Anything larger will be // allocated per request and thrown away afterwards to avoid allocating very big buffers. PoolCutOffBufferSize = 1024 * 1024 // 1MiB // MinBufferSize specifies the smallest buffer size that would be allocated for connections. Smaller buffer // requests will allocate at least this amount of memory. This protects against allocating too many small // buffers that would require reallocation and putting pressure on the GC. MinBufferSize = 8 * 1024 // 8 KiB )
var ( ErrServerNotAvailable = newConstError(types.SERVER_NOT_AVAILABLE) ErrInvalidPartitionMap = newConstError(types.INVALID_CLUSTER_PARTITION_MAP, "Partition map errors normally occur when the cluster has partitioned due to network anomaly or node crash, or is not configured properly. Refer to https://www.aerospike.com/docs/operations/configure for more information.") ErrKeyNotFound = newConstError(types.KEY_NOT_FOUND_ERROR) ErrRecordsetClosed = newConstError(types.RECORDSET_CLOSED) ErrConnectionPoolEmpty = newConstError(types.NO_AVAILABLE_CONNECTIONS_TO_NODE, "connection pool is empty. This happens when no connections were available") ErrConnectionPoolExhausted = newConstError(types.NO_AVAILABLE_CONNECTIONS_TO_NODE, "Connection pool is exhausted. This happens when all connection are in-use already, and opening more connections is not allowed due to the limits set in policy.ConnectionQueueSize and policy.LimitConnectionsToQueueSize") ErrTooManyConnectionsForNode = newConstError(types.NO_AVAILABLE_CONNECTIONS_TO_NODE, "connection limit reached for this node. This value is controlled via ClientPolicy.LimitConnectionsToQueueSize") ErrTooManyOpeningConnections = newConstError(types.NO_AVAILABLE_CONNECTIONS_TO_NODE, "too many connections are trying to open at once. This value is controlled via ClientPolicy.OpeningConnectionThreshold") ErrTimeout = newConstError(types.TIMEOUT, "command execution timed out on client: See `Policy.Timeout`") ErrNetTimeout = newConstError(types.TIMEOUT, "network timeout") ErrUDFBadResponse = newConstError(types.UDF_BAD_RESPONSE, "invalid UDF return value") ErrNoOperationsSpecified = newConstError(types.INVALID_COMMAND, "no operations were passed to QueryExecute") ErrNoBinNamesAllowedInQueryExecute = newConstError(types.INVALID_COMMAND, "`Statement.BinNames` must be empty for QueryExecute") ErrFilteredOut = newConstError(types.FILTERED_OUT) ErrPartitionScanQueryNotSupported = newConstError(types.PARAMETER_ERROR, "partition Scans/Queries are not supported by all nodes in this cluster") ErrScanTerminated = newConstError(types.SCAN_TERMINATED) ErrQueryTerminated = newConstError(types.QUERY_TERMINATED) ErrClusterIsEmpty = newConstError(types.INVALID_NODE_ERROR, "cluster is empty") ErrInvalidUser = newConstError(types.INVALID_USER) ErrNotAuthenticated = newConstError(types.NOT_AUTHENTICATED) ErrNetwork = newConstError(types.NETWORK_ERROR) ErrInvalidObjectType = newConstError(types.SERIALIZE_ERROR, "invalid type for result object. It should be of type struct pointer or addressable") ErrMaxRetriesExceeded = newConstError(types.MAX_RETRIES_EXCEEDED, "command execution timed out on client: Exceeded number of retries. See `Policy.MaxRetries`.") ErrInvalidParam = newConstError(types.PARAMETER_ERROR) ErrLuaPoolEmpty = newConstError(types.COMMON_ERROR, "Error fetching a lua instance from pool") )
var AEROSPIKE_CLIENT_CONFIG_URL = os.Getenv("AEROSPIKE_CLIENT_CONFIG_URL")
AEROSPIKE_CLIENT_CONFIG_URL is the environment variable that can be set to load the Aerospike client configuration from a URL.
var DefaultStringPolicy = &StringPolicy{flags: int(StringWriteDefault)}
DefaultStringPolicy is the default per-operation policy. It uses StringWriteDefault flags.
var MapOrder = struct { // Map is not ordered. This is the default. UNORDERED mapOrderType // 0 // Order map by key. KEY_ORDERED mapOrderType // 1 // Order map by key, then value. KEY_VALUE_ORDERED mapOrderType // 3 }{mapOrderType{0, 0x40}, mapOrderType{1, 0x80}, mapOrderType{3, 0xc0}}
MapOrder defines map storage order.
var MapReturnType = struct { // NONE will will not return a result. NONE mapReturnType // INDEX will return key index order. // // 0 = first key // N = Nth key // -1 = last key INDEX mapReturnType // REVERSE_INDEX will return reverse key order. // // 0 = last key // -1 = first key REVERSE_INDEX mapReturnType // RANK will return value order. // // 0 = smallest value // N = Nth smallest value // -1 = largest value RANK mapReturnType // REVERSE_RANK will return reverse value order. // // 0 = largest value // N = Nth largest value // -1 = smallest value REVERSE_RANK mapReturnType // COUNT will return count of items selected. COUNT mapReturnType // KEY will return key for single key read and key list for range read. KEY mapReturnType // VALUE will return value for single key read and value list for range read. VALUE mapReturnType // KEY_VALUE will return key/value items. The possible return types are: // // map[any]any : Returned for unordered maps // []MapPair : Returned for range results where range order needs to be preserved. KEY_VALUE mapReturnType // EXISTS returns true if count > 0. EXISTS mapReturnType // UNORDERED_MAP returns an unordered map. UNORDERED_MAP mapReturnType // ORDERED_MAP returns an ordered map. ORDERED_MAP mapReturnType // INVERTED will invert meaning of map command and return values. For example: // MapRemoveByKeyRange(binName, keyBegin, keyEnd, MapReturnType.KEY | MapReturnType.INVERTED) // With the INVERTED flag enabled, the keys outside of the specified key range will be removed and returned. INVERTED mapReturnType }{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 16, 17, 0x10000, }
MapReturnType defines the map return type. Type of data to return when selecting or removing items from the map.
var MapWriteMode = struct { // If the key already exists, the item will be overwritten. // If the key does not exist, a new item will be created. UPDATE *mapWriteMode // If the key already exists, the item will be overwritten. // If the key does not exist, the write will fail. UPDATE_ONLY *mapWriteMode // If the key already exists, the write will fail. // If the key does not exist, a new item will be created. CREATE_ONLY *mapWriteMode }{ &mapWriteMode{cdtMapOpTypePut, cdtMapOpTypePutItems}, &mapWriteMode{cdtMapOpTypeReplace, cdtMapOpTypeReplaceItems}, &mapWriteMode{cdtMapOpTypeAdd, cdtMapOpTypeAddItems}, }
MapWriteMode should only be used for server versions < 4.3. MapWriteFlags are recommended for server versions >= 4.3.
var StackTracesEnabled = false
Specifies if stack traces should be included in the error.
var UseNativeBoolTypeInReflection = false
UseNativeBoolTypeInReflection determines if Boolean values should be directly translated to native Boolean type in reflection API introduced in server version 5.6+. By default it keeps the old behavior, but can be set to true to opt in.
Deprecated: Will be removed in the next major version.
Functions ¶
func Base64ToCDTContext ¶
func Base64ToCDTContext(b64 string) ([]*CDTContext, Error)
Base64ToCDTContext converts a b64 encoded string back into a []*CDTContext.
func ExpFromAEL ¶ added in v8.9.0
func ExpFromAEL(text string) (*Expression, Error)
ExpFromAEL creates a filter expression from AEL (Aerospike Expression Language) source text for the server to compile and evaluate. The client does no parsing or validation: the text is framed and sent as-is, and the server rejects invalid AEL with PARAMETER_ERROR, detailing the parser message and the 1-based line and column of the first error.
The result is a complete, standalone filter expression. The server accepts the AEL opcode only as the top level of the payload, so assign it directly to a policy's FilterExpression and never nest it inside ExpAnd, ExpOr, ExpNot or any other expression.
Requires a server that supports EXP_AEL_COMPILE (v8.2.0+); older servers reject the payload. The text must not be empty.
func ExpFromBase64 ¶
func ExpFromBase64(str string) (*Expression, Error)
ExpFromBase64 creates an expression from an encoded base64 expression.
func GetNodeBatchRead ¶
func GetNodeBatchRead(cluster *Cluster, key *Key, replica ReplicaPolicy, replicaSC ReplicaPolicy, prevNode *Node, sequence int, sequenceSC int) (*Node, Error)
GetNodeBatchRead returns a node for batch reads
func GetNodeBatchWrite ¶
func GetNodeBatchWrite(cluster *Cluster, key *Key, replica ReplicaPolicy, prevNode *Node, sequence int) (*Node, Error)
GetNodeBatchWrite returns a node for batch Writes
func KeepConnection ¶
KeepConnection decides if a connection should be kept based on the error type.
func NewClient ¶
NewClient generates a new Client instance. The connection pool after connecting to the database is initially empty, and connections are established on a per need basis, which can be slow and time out some initial commands. It is recommended to call the client.WarmUp() method right after connecting to the database to fill up the connection pool to the required service level.
func NewClientWithPolicy ¶
func NewClientWithPolicy(policy *ClientPolicy, hostname string, port int) (*Client, Error)
NewClientWithPolicy generates a new Client using the specified ClientPolicy. If the policy is nil, the default relevant policy will be used. The connection pool after connecting to the database is initially empty, and connections are established on a per need basis, which can be slow and time out some initial commands. It is recommended to call the client.WarmUp() method right after connecting to the database to fill up the connection pool to the required service level.
func NewClientWithPolicyAndHost ¶
func NewClientWithPolicyAndHost(policy *ClientPolicy, hosts ...*Host) (*Client, Error)
NewClientWithPolicyAndHost generates a new Client with the specified ClientPolicy and sets up the cluster using the provided hosts. If the policy is nil, the default relevant policy will be used. The connection pool after connecting to the database is initially empty, and connections are established on a per need basis, which can be slow and time out some initial commands. It is recommended to call the client.WarmUp() method right after connecting to the database to fill up the connection pool to the required service level.
func NewCluster ¶
NewCluster generates a Cluster instance.
func NewConnection ¶
func NewConnection(policy *ClientPolicy, host *Host) (*Connection, Error)
NewConnection creates a TLS connection on the network and returns the pointer. A minimum timeout of 2 seconds will always be applied. If the connection is not established in the specified timeout, an error will be returned
func NewKey ¶
NewKey initializes a key from namespace, optional set name and user key. The set name and user defined key are converted to a digest before sending to the server. The server handles record identifiers by digest only.
func NewKeyWithDigest ¶
NewKeyWithDigest initializes a key from namespace, optional set name and user key. The server handles record identifiers by digest only.
func PartitionForRead ¶
func PartitionForRead(cluster *Cluster, policy *BasePolicy, key *Key) (*Partition, Error)
PartitionForRead returns a partition for read purposes
func PartitionForWrite ¶
func PartitionForWrite(cluster *Cluster, policy *BasePolicy, key *Key) (*Partition, Error)
PartitionForWrite returns a partition for write purposes
func SetAerospikeTag ¶
func SetAerospikeTag(tag string)
SetAerospikeTag sets the bin tag to the specified tag. This will be useful for when a user wants to use the same tag name for two different concerns. For example, one will be able to use the same tag name for both json and aerospike bin name.
func SetLuaPath ¶
func SetLuaPath(lpath string)
SetLuaPath sets the Lua interpreter path to files This path is used to load UDFs for QueryAggregate command
Types ¶
type AbortStatus ¶
type AbortStatus string
Transaction abort status code.
const ( AbortStatusOK AbortStatus = "Abort succeeded" AbortStatusAlreadyCommitted AbortStatus = "Already committed" AbortStatusAlreadyAborted AbortStatus = "Already aborted" AbortStatusCommitFailed AbortStatus = "Abort not allowed because a commit already failed on this transaction with an in-doubt outcome" AbortStatusRollBackAbandoned AbortStatus = "Transaction client roll back abandoned. Server will eventually abort the Transaction." AbortStatusCloseAbandoned AbortStatus = "Transaction has been rolled back, but Transaction client close was abandoned. Server will eventually close the Transaction." )
type AdminCommand ¶
type AdminCommand struct {
// contains filtered or unexported fields
}
AdminCommand allows managing user access to the server
func NewAdminCommand ¶
func NewAdminCommand(buf []byte) *AdminCommand
NewAdminCommand returns an AdminCommand object.
func (*AdminCommand) QueryRole ¶
func (acmd *AdminCommand) QueryRole(conn *Connection, policy *AdminPolicy, roleName string) (*Role, Error)
QueryRole returns role information.
func (*AdminCommand) QueryRoles ¶
func (acmd *AdminCommand) QueryRoles(conn *Connection, policy *AdminPolicy) ([]*Role, Error)
QueryRoles returns role information for all roles.
func (*AdminCommand) QueryUser ¶
func (acmd *AdminCommand) QueryUser(conn *Connection, policy *AdminPolicy, user string) (*UserRoles, Error)
QueryUser returns user information.
func (*AdminCommand) QueryUsers ¶
func (acmd *AdminCommand) QueryUsers(conn *Connection, policy *AdminPolicy) ([]*UserRoles, Error)
QueryUsers returns user information for all users.
type AdminPolicy ¶
type AdminPolicy struct {
// User administration command socket timeout.
// Default is 2 seconds.
Timeout time.Duration
}
AdminPolicy contains attributes used for user administration commands.
func NewAdminPolicy ¶
func NewAdminPolicy() *AdminPolicy
NewAdminPolicy generates a new AdminPolicy with default values.
type AerospikeBlob ¶
type AerospikeBlob interface {
// EncodeBlob returns a byte slice representing the encoding of the
// receiver for transmission to a Decoder, usually of the same
// concrete type.
EncodeBlob() ([]byte, error)
}
AerospikeBlob interface allows the user to write a conversion function from their value to []bytes.
type AerospikeError ¶
type AerospikeError struct {
// Node where the error occurred
Node *Node
// ResultCode determines the type of error
ResultCode types.ResultCode
// InDoubt determines if the command was sent to the server, but
// there is doubt if the server received and executed the command
// and changed the data. Only applies to commands that change data
InDoubt bool
// Iteration determies on which retry the error occurred
Iteration int
// SubCode is the server-supplied error subcode (see the SubCode* constants
// in the types package). Defaults to [types.SubCodeNone] (0).
//
// A subcode is only meaningful when interpreted together with ResultCode:
// subcode integer values are scoped to their parent result code and are
// NOT globally unique. Dispatch on the (ResultCode, SubCode) pair.
//
// Populated only when BasePolicy.ErrorDetailVerbosity > 0 and the
// failing branch dispatched a subcode. Requires server version 8.2.0+.
SubCode types.SubCode
// ServerMessage is the formatted server-supplied error detail
// (human-readable message and/or subcode tag). Empty when the server
// did not send a detail.
ServerMessage string
// ExpTrace is the server-supplied expression trace, or nil when absent.
//
// Populated only at error-detail verbosity 3 (see
// [BasePolicy.ErrorDetailVerbosity]) when a metadata/predicate filter
// (filter_exp) or an exp_read/exp_write operation fails to build, faults during
// evaluation, or rejects a record.
//
// Do not key trace handling off ResultCode. Build failures carry
// [types.PARAMETER_ERROR] and [types.SubCodeNone], but eval-phase traces ride
// whatever result code the evaluation produced - typically [types.FILTERED_OUT]
// or [types.OP_NOT_APPLICABLE]. Code that inspects ExpTrace only on
// PARAMETER_ERROR silently drops every eval-phase trace.
//
// nil on non-expression failures, and also on an expression failure whose trace
// the server's error-detail byte budget squeezed out entirely. See
// [ExpressionTrace].
ExpTrace *ExpressionTrace
// contains filtered or unexported fields
}
AerospikeError implements Error interface for aerospike specific errors. All errors returning from the library are of this type. Errors resulting from Go's stdlib are not translated to this type, unless they are a net.Timeout error. Refer to errors_test.go for examples. To be able to check for error type, you could use the idiomatic errors.Is and errors.As patterns:
if errors.Is(err, as.ErrTimeout) {
...
}
or
if errors.Is(err, &as.AerospikeError{ResultCode: ast.PARAMETER_ERROR}) {
...
}
or
if err.Matches(ast.TIMEOUT, ast.NETWORK_ERROR, ast.PARAMETER_ERROR) {
...
}
or
ae := &as.AerospikeError{}
if errors.As(err, &ae) {
println(ae.ResultCode)
}
func (*AerospikeError) As ¶
func (ase *AerospikeError) As(target any) bool
As implements the interface for errors.As function.
func (*AerospikeError) Error ¶
func (ase *AerospikeError) Error() string
Error implements the error interface
func (*AerospikeError) Is ¶
func (ase *AerospikeError) Is(e error) bool
Is compares an error with the AerospikeError. If the error is not of type *AerospikeError, it will return false. Otherwise, it will compare ResultCode and Node (if it exists), and will return a result accordingly. If passed error's InDoubt is set to true, the InDoubt property will also be checked. You should not check if the error's InDoubt is false, since it is not checked when the passed error's InDoubt is false.
func (*AerospikeError) IsInDoubt ¶
func (ase *AerospikeError) IsInDoubt() bool
IsInDoubt signifies that the write operation may have gone through on the server but the client is not able to confirm that due an error.
func (*AerospikeError) Matches ¶
func (ase *AerospikeError) Matches(rcs ...types.ResultCode) bool
Matches returns true if the error or any of its wrapped errors contains any of the passed results codes. For convenience, it will return false if the error is nil.
func (*AerospikeError) Trace ¶
func (ase *AerospikeError) Trace() string
Trace returns a stack trace of where the error originates from
func (*AerospikeError) Unwrap ¶
func (ase *AerospikeError) Unwrap() error
Unwrap will return the error wrapped inside the error, or nil.
type AuthMode ¶
type AuthMode int
AuthMode determines authentication mode.
const ( // AuthModeInternal uses internal authentication only when user/password defined. Hashed password is stored // on the server. Do not send clear password. This is the default. AuthModeInternal AuthMode = iota // AuthModeExternal uses external authentication (like LDAP) when user/password defined. Specific external authentication is // configured on server. If TLSConfig is defined, sends clear password on node login via TLS. // Will return an error if TLSConfig is not defined. AuthModeExternal // AuthModePKI allows authentication and authorization based on a certificate. No user name or // password needs to be configured. Requires TLS and a client certificate. // Requires server version 5.7.0+ AuthModePKI )
type BasePolicy ¶
type BasePolicy struct {
// Multi-record transaction identifier (Transaction). If this field is populated, the corresponding
// command will be included in the Transaction. This field is ignored for scan/query.
Txn *Txn
// FilterExpression is the optional Filter Expression. Supported on Server v5.2+
FilterExpression *Expression
// ReadModeAP indicates read policy for AP (availability) namespaces.
ReadModeAP ReadModeAP //= ONE
// ReadModeSC indicates read policy for SC (strong consistency) namespaces.
ReadModeSC ReadModeSC //= SESSION;
// TotalTimeout specifies total command timeout.
//
// The TotalTimeout is tracked on the client and also sent to the server along
// with the command in the wire protocol. The client will most likely
// timeout first, but the server has the capability to Timeout the command.
//
// If TotalTimeout is not zero and TotalTimeout is reached before the command
// completes, the command will abort with TotalTimeout error.
//
// If TotalTimeout is zero, there will be no time limit and the command will retry
// on network timeouts/errors until MaxRetries is exceeded. If MaxRetries is exceeded, the
// command also aborts with Timeout error.
//
// Default for scan/query: 0 (no time limit and rely on MaxRetries)
//
// Default for all other commands: 1000ms
TotalTimeout time.Duration
// SocketTimeout determines network timeout for each attempt.
//
// If SocketTimeout is not zero and SocketTimeout is reached before an attempt completes,
// the Timeout above is checked. If Timeout is not exceeded, the command
// is retried. If both SocketTimeout and Timeout are non-zero, SocketTimeout must be less
// than or equal to Timeout, otherwise Timeout will also be used for SocketTimeout.
//
// Default: 30s
SocketTimeout time.Duration
// MaxRetries determines the maximum number of retries before aborting the current command.
// The initial attempt is not counted as a retry.
//
// If MaxRetries is exceeded, the command will abort with an error.
//
// WARNING: Database writes that are not idempotent (such as AddOp)
// should not be retried because the write operation may be performed
// multiple times if the client timed out previous command attempts.
// It's important to use a distinct WritePolicy for non-idempotent
// writes which sets maxRetries = 0;
//
// Default for read: 2 (initial attempt + 2 retries = 3 attempts)
//
// Default for write: 0 (no retries)
//
// Default for partition scan or query with nil filter: 5
// (6 attempts. See ScanPolicy comments.)
MaxRetries int //= 2;
// ReadTouchTTLPercent determines how record TTL (time to live) is affected on reads. When enabled, the server can
// efficiently operate as a read-based LRU cache where the least recently used records are expired.
// The value is expressed as a percentage of the TTL sent on the most recent write such that a read
// within this interval of the record’s end of life will generate a touch.
//
// For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
// 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
// recent write) will result in a touch, resetting the TTL to another 10 hours.
//
// Values:
//
// 0 : Use server config default-read-touch-ttl-pct for the record's namespace/set.
// -1 : Do not reset record TTL on reads.
// 1 - 100 : Reset record TTL on reads when within this percentage of the most recent write TTL.
// Default: 0
ReadTouchTTLPercent int32
// SleepBetweenRtries determines the duration to sleep between retries. Enter zero to skip sleep.
// This field is ignored when maxRetries is zero.
// This field is also ignored in async mode.
//
// The sleep only occurs on connection errors and server timeouts
// which suggest a node is down and the cluster is reforming.
// The sleep does not occur when the client's socketTimeout expires.
//
// Reads do not have to sleep when a node goes down because the cluster
// does not shut out reads during cluster reformation. The default for
// reads is zero.
//
// The default for writes is also zero because writes are not retried by default.
// Writes need to wait for the cluster to reform when a node goes down.
// Immediate write retries on node failure have been shown to consistently
// result in errors. If maxRetries is greater than zero on a write, then
// sleepBetweenRetries should be set high enough to allow the cluster to
// reform (>= 500ms).
SleepBetweenRetries time.Duration //= 1ms;
// SleepMultiplier specifies the multiplying factor to be used for exponential backoff during retries.
// Default to (1.0); Only values greater than 1 are valid.
SleepMultiplier float64 //= 1.0;
// ExitFastOnExhaustedConnectionPool determines if a command that tries to get a
// connection from the connection pool will wait and retry in case the pool is
// exhausted until a connection becomes available (or the TotalTimeout is reached).
// If set to true, an error will be return immediately.
// If set to false, getting a connection will be retried.
// This only applies if LimitConnectionsToQueueSize is set to true and the number of open connections to a node has reached ConnectionQueueSize.
// The default is false
ExitFastOnExhaustedConnectionPool bool // false
// SendKey determines to whether send user defined key in addition to hash digest on both reads and writes.
// If the key is sent on a write, the key will be stored with the record on
// the server.
//
// If the key is sent on a read, the server will generate the hash digest from
// the key and validate that digest with the digest sent by the client. Unless
// this is the explicit intent of the developer, avoid sending the key on reads.
// The default is to not send the user defined key.
SendKey bool // = false
// UseCompression uses zlib compression on command buffers sent to the server and responses received
// from the server when the buffer size is greater than 128 bytes.
//
// This option will increase cpu and memory usage (for extra compressed buffers),but
// decrease the size of data sent over the network.
//
// Valid for Aerospike Server Enterprise Edition only.
//
// Default: false
UseCompression bool // = false
// ReplicaPolicy specifies the algorithm used to determine the target node for a partition derived from a key
// or requested in a scan/query.
// Write commands are not affected by this setting, because all writes are directed
// to the node containing the key's master partition.
// Default to sending read commands to the node containing the key's master partition.
ReplicaPolicy ReplicaPolicy
// Delay milliseconds after socket read timeout in an attempt to recover the socket
// in the background. Processing continues on the original command and the user
// is still notified at the original command timeout.
TimeoutDelay time.Duration // = 0
// ErrorDetailVerbosity requests server error detail fields in responses.
// 0 - disabled (no error details).
// 1 - subcode only.
// 2 - subcode + message.
// 3 - subcode, message, and (on expression build-failure paths) a structured
// expression trace, surfaced on [AerospikeError.ExpTrace].
// Default: 0
// Requires Aerospike server version 8.2.0 or later. Older servers ignore the flag.
ErrorDetailVerbosity int
}
BasePolicy encapsulates parameters for command policy attributes used in all database operation calls.
func NewPolicy ¶
func NewPolicy() *BasePolicy
NewPolicy generates a new BasePolicy instance with default values.
func (*BasePolicy) GetBasePolicy ¶
func (bp *BasePolicy) GetBasePolicy() *BasePolicy
GetBasePolicy returns embedded BasePolicy in all types that embed this struct.
type BatchDelete ¶
type BatchDelete struct {
BatchRecord
// Policy os the optional write Policy.
Policy *BatchDeletePolicy
}
BatchDelete encapsulates a batch delete operation.
func NewBatchDelete ¶
func NewBatchDelete(policy *BatchDeletePolicy, key *Key) *BatchDelete
NewBatchDelete creates a batch delete operation.
type BatchDeletePolicy ¶
type BatchDeletePolicy struct {
// FilterExpression is optional expression filter. If FilterExpression exists and evaluates to false, the specific batch key
// request is not performed and BatchRecord.ResultCode is set to type.FILTERED_OUT.
// Default: nil
FilterExpression *Expression
// Desired consistency guarantee when committing a command on the server. The default
// (COMMIT_ALL) indicates that the server should wait for master and all replica commits to
// be successful before returning success to the client.
// Default: CommitLevel.COMMIT_ALL
CommitLevel CommitLevel //= COMMIT_ALL
// Qualify how to handle record deletes based on record generation. The default (NONE)
// indicates that the generation is not used to restrict deletes.
// Default: GenerationPolicy.NONE
GenerationPolicy GenerationPolicy //= GenerationPolicy.NONE;
// Expected generation. Generation is the number of times a record has been modified
// (including creation) on the server. This field is only relevant when generationPolicy
// is not NONE.
// Default: 0
Generation uint32
// If the command results in a record deletion, leave a tombstone for the record.
// This prevents deleted records from reappearing after node failures.
// Valid for Aerospike Server Enterprise Edition only.
// Default: false (do not tombstone deleted records).
DurableDelete bool
// Send user defined key in addition to hash digest.
// If true, the key will be stored with the tombstone record on the server.
// Default: false (do not send the user defined key)
SendKey bool
}
BatchDeletePolicy is used in batch delete commands.
func NewBatchDeletePolicy ¶
func NewBatchDeletePolicy() *BatchDeletePolicy
NewBatchDeletePolicy returns a default BatchDeletePolicy.
type BatchOffsets ¶
type BatchOffsets interface {
// contains filtered or unexported methods
}
type BatchPolicy ¶
type BatchPolicy struct {
BasePolicy
// Maximum number of concurrent batch request goroutines to server nodes at any point in time.
// If there are 16 node/namespace combinations requested and ConcurrentNodes is 8,
// then batch requests will be made for 8 node/namespace combinations in concurrent goroutines.
// When a request completes, a new request will be issued until all 16 goroutines are complete.
//
// Values:
// 1: Issue batch requests sequentially. This mode has a performance advantage for small
// to medium sized batch sizes because requests can be issued in the main command goroutine.
// This is the default.
// 0: Issue all batch requests in concurrent goroutines. This mode has a performance
// advantage for extremely large batch sizes because each node can process the request
// immediately. The downside is extra goroutines will need to be created (or taken from
// a goroutine pool).
// > 0: Issue up to ConcurrentNodes batch requests in concurrent goroutines. When a request
// completes, a new request will be issued until all goroutines are complete. This mode
// prevents too many concurrent goroutines being created for large cluster implementations.
// The downside is extra goroutines will still need to be created (or taken from a goroutine pool).
ConcurrentNodes int // = 1
// Allow batch to be processed immediately in the server's receiving thread when the server
// deems it to be appropriate. If false, the batch will always be processed in separate
// command goroutines. This field is only relevant for the new batch index protocol.
//
// For batch exists or batch reads of smaller sized records (<= 1K per record), inline
// processing will be significantly faster on "in memory" namespaces. The server disables
// inline processing on disk based namespaces regardless of this policy field.
//
// Inline processing can introduce the possibility of unfairness because the server
// can process the entire batch before moving onto the next command.
AllowInline bool //= true
// Allow batch to be processed immediately in the server's receiving thread for SSD
// namespaces. If false, the batch will always be processed in separate service threads.
// Server versions before 6.0 ignore this field.
//
// Inline processing can introduce the possibility of unfairness because the server
// can process the entire batch before moving onto the next command.
//
// Default: false
AllowInlineSSD bool // = false
// Should all batch keys be attempted regardless of errors. This field is used on both
// the client and server. The client handles node specific errors and the server handles
// key specific errors.
//
// If true, every batch key is attempted regardless of previous key specific errors.
// Node specific errors such as timeouts stop keys to that node, but keys directed at
// other nodes will continue to be processed.
//
// If false, the server will stop the batch to its node on most key specific errors.
// The exceptions are types.KEY_NOT_FOUND_ERROR and types.FILTERED_OUT which never stop the batch.
// The client will stop the entire batch on node specific errors for sync commands
// that are run in sequence (MaxConcurrentThreads == 1). The client will not stop
// the entire batch for async commands or sync commands run in parallel.
//
// Server versions < 6.0 do not support this field and treat this value as false
// for key specific errors.
//
// Default: true
RespondAllKeys bool //= true;
// AllowPartialResults determines if the results for some nodes should be returned in case
// some nodes encounter an error. The result for the unreceived records will be nil.
// The returned records will be safe to use, since only fully received data will be parsed
// and set.
//
// This flag is checked at the client level for:
// - BatchGet, BatchGetOperate, and BatchGetHeader methods
// - BatchGetComplex (which always returns partial results by design)
//
// For BatchOperate (with BatchRead, BatchWrite, BatchDelete, BatchUDF records) and BatchDelete:
// - When batch contains only ONE record: AllowPartialResults is checked during single-record execution
// - When batch contains MULTIPLE records: Errors from batchExecute are returned directly without
// checking this flag at the client level. However, the flag is still respected during batch
// retry/split scenarios to allow partial results from different nodes.
//
// Default: false
AllowPartialResults bool //= false
}
BatchPolicy encapsulates parameters for policy attributes used in write operations. This object is passed into methods where database writes can occur.
func NewBatchPolicy ¶
func NewBatchPolicy() *BatchPolicy
NewBatchPolicy initializes a new BatchPolicy instance with default parameters.
func NewReadBatchPolicy ¶
func NewReadBatchPolicy() *BatchPolicy
NewReadBatchPolicy initializes a new BatchPolicy instance for reads.
func NewWriteBatchPolicy ¶
func NewWriteBatchPolicy() *BatchPolicy
NewWriteBatchPolicy initializes a new BatchPolicy instance for writes.
type BatchRead ¶
type BatchRead struct {
BatchRecord
// Optional read policy.
Policy *BatchReadPolicy
// BinNames specifies the Bins to retrieve for this key.
// BinNames are mutually exclusive with Ops.
BinNames []string
// ReadAllBins defines what data should be read from the record.
// If true, ignore binNames and read all bins.
// If false and binNames are set, read specified binNames.
// If false and binNames are not set, read record header (generation, expiration) only.
ReadAllBins bool //= false
// Ops specifies the operations to perform for every key.
// Ops are mutually exclusive with BinNames.
// A binName can be emulated with `GetOp(binName)`
// Supported by server v5.6.0+.
Ops []*Operation
}
BatchRead specifies the Key and bin names used in batch read commands where variable bins are needed for each key.
func NewBatchRead ¶
func NewBatchRead(policy *BatchReadPolicy, key *Key, binNames []string) *BatchRead
NewBatchRead defines a key and bins to retrieve in a batch operation.
func NewBatchReadHeader ¶
func NewBatchReadHeader(policy *BatchReadPolicy, key *Key) *BatchRead
NewBatchReadHeader defines a key to retrieve the record headers only in a batch operation.
func NewBatchReadOps ¶
func NewBatchReadOps(policy *BatchReadPolicy, key *Key, ops ...*Operation) *BatchRead
NewBatchReadOps defines a key and bins to retrieve in a batch operation, including expressions.
type BatchReadPolicy ¶
type BatchReadPolicy struct {
// FilterExpression is the optional expression filter. If FilterExpression exists and evaluates to false, the specific batch key
// request is not performed and BatchRecord.ResultCode is set to types.FILTERED_OUT.
//
// Default: nil
FilterExpression *Expression
// ReadModeAP indicates read policy for AP (availability) namespaces.
ReadModeAP ReadModeAP //= ONE
// ReadModeSC indicates read policy for SC (strong consistency) namespaces.
ReadModeSC ReadModeSC //= SESSION;
// ReadTouchTTLPercent determines how record TTL (time to live) is affected on reads. When enabled, the server can
// efficiently operate as a read-based LRU cache where the least recently used records are expired.
// The value is expressed as a percentage of the TTL sent on the most recent write such that a read
// within this interval of the record’s end of life will generate a touch.
//
// For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
// 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
// recent write) will result in a touch, resetting the TTL to another 10 hours.
//
// Values:
//
// 0 : Use server config default-read-touch-ttl-pct for the record's namespace/set.
// -1 : Do not reset record TTL on reads.
// 1 - 100 : Reset record TTL on reads when within this percentage of the most recent write TTL.
// Default: 0
ReadTouchTTLPercent int32
}
BatchReadPolicy attributes used in batch read commands.
func NewBatchReadPolicy ¶
func NewBatchReadPolicy() *BatchReadPolicy
NewBatchReadPolicy returns a policy instance for BatchRead commands.
type BatchRecord ¶
type BatchRecord struct {
// Key.
Key *Key
// Record result after batch command has completed. Will be nil if record was not found
// or an error occurred. See ResultCode.
Record *Record
// ResultCode for this returned record. See types.ResultCode.
// If not OK, the record will be nil.
ResultCode types.ResultCode
// Err encapsulates the possible error chain for this key
Err Error
// InDoubt signifies the possibility that the write command may have completed even though an error
// occurred for this record. This may be the case when a client error occurs (like timeout)
// after the command was sent to the server.
InDoubt bool
// ServerMessage is the formatted server-side error detail (message and/or
// subcode) for this row, populated when the batch opted into
// ErrorDetailVerbosity > 0 and the server attached field 45. Empty otherwise.
ServerMessage string
// SubCode is the numeric server-supplied subcode for this row (see SubCode*
// constants in the types package). Defaults to [types.SubCodeNone] (0).
SubCode types.SubCode
// ExpTrace is the server-supplied expression build trace for this row, sent
// only at verbosity 3 on expression build-failure paths. nil when absent.
ExpTrace *ExpressionTrace
// contains filtered or unexported fields
}
BatchRecord encapsulates the Batch key and record result.
func (*BatchRecord) BatchRec ¶
func (br *BatchRecord) BatchRec() *BatchRecord
BatchRec returns the embedded batch record in the interface.
func (*BatchRecord) String ¶
func (br *BatchRecord) String() string
String implements the Stringer interface.
type BatchRecordIfc ¶
type BatchRecordIfc interface {
// Returns the BatchRecord
BatchRec() *BatchRecord
String() string
// contains filtered or unexported methods
}
BatchRecordIfc is the interface type to encapsulate BatchRead, BatchWrite and BatchUDF commands.
type BatchUDF ¶
type BatchUDF struct {
BatchRecord
// Policy is the optional UDF Policy.
Policy *BatchUDFPolicy
// PackageName specify the lua module name.
PackageName string
// FunctionName specify Lua function name.
FunctionName string
// FunctionArgs specify optional arguments to lua function.
FunctionArgs []Value
// contains filtered or unexported fields
}
BatchUDF encapsulates a batch user defined function operation.
func NewBatchUDF ¶
func NewBatchUDF(policy *BatchUDFPolicy, key *Key, packageName, functionName string, functionArgs ...Value) *BatchUDF
NewBatchUDF creates a batch UDF operation.
type BatchUDFPolicy ¶
type BatchUDFPolicy struct {
// Optional expression filter. If FilterExpression exists and evaluates to false, the specific batch key
// request is not performed and BatchRecord.ResultCode is set to types.FILTERED_OUT.
//
// Default: nil
FilterExpression *Expression
// Desired consistency guarantee when committing a command on the server. The default
// (COMMIT_ALL) indicates that the server should wait for master and all replica commits to
// be successful before returning success to the client.
//
// Default: CommitLevel.COMMIT_ALL
CommitLevel CommitLevel //= COMMIT_ALL
// Expiration determines record expiration in seconds. Also known as TTL (Time-To-Live).
// Seconds record will live before being removed by the server.
// Expiration values:
// TTLServerDefault (0): Default to namespace configuration variable "default-ttl" on the server.
// TTLDontExpire (MaxUint32): Never expire for Aerospike 2 server versions >= 2.7.2 and Aerospike 3+ server
// TTLDontUpdate (MaxUint32 - 1): Do not change ttl when record is written. Supported by Aerospike server versions >= 3.10.1
// > 0: Actual expiration in seconds.
Expiration uint32
// DurableDelete leaves a tombstone for the record if the command results in a record deletion.
// This prevents deleted records from reappearing after node failures.
// Valid for Aerospike Server Enterprise Edition 3.10+ only.
DurableDelete bool
// Execute the write command only if the record is not already locked by this transaction.
// If this field is true and the record is already locked by this transaction, the command
// will return an error with the [types.MRT_ALREADY_LOCKED] error code.
//
// This field is useful for safely retrying non-idempotent writes as an alternative to simply
// aborting the transaction.
//
// Default: false
OnLockingOnly bool
// SendKey determines to whether send user defined key in addition to hash digest on both reads and writes.
// If true and the UDF writes a record, the key will be stored with the record on the server.
// The default is to not send the user defined key.
SendKey bool // = false
}
BatchUDFPolicy attributes used in batch UDF execute commands.
func NewBatchUDFPolicy ¶
func NewBatchUDFPolicy() *BatchUDFPolicy
NewBatchUDFPolicy returns a policy instance for Batch UDF commands.
type BatchWrite ¶
type BatchWrite struct {
BatchRecord
// Policy is an optional write Policy.
Policy *BatchWritePolicy
// Ops specify required operations for this key.
Ops []*Operation
}
BatchWrite encapsulates a batch key and read/write operations with write policy.
func NewBatchWrite ¶
func NewBatchWrite(policy *BatchWritePolicy, key *Key, ops ...*Operation) *BatchWrite
NewBatchWrite initializes policy, batch key and read/write operations. ANy GetOp() is not allowed because it returns a variable number of bins and makes it difficult (sometimes impossible) to lineup operations with results. Instead, use GetBinOp(string) for each bin name.
type BatchWritePolicy ¶
type BatchWritePolicy struct {
// FilterExpression is optional expression filter. If FilterExpression exists and evaluates to false, the specific batch key
// request is not performed and BatchRecord#resultCode is set to types.FILTERED_OUT.
//
// Default: nil
FilterExpression *Expression
// RecordExistsAction qualifies how to handle writes where the record already exists.
RecordExistsAction RecordExistsAction //= RecordExistsAction.UPDATE;
// Desired consistency guarantee when committing a command on the server. The default
// (COMMIT_ALL) indicates that the server should wait for master and all replica commits to
// be successful before returning success to the client.
//
// Default: CommitLevel.COMMIT_ALL
CommitLevel CommitLevel //= COMMIT_ALL
// GenerationPolicy qualifies how to handle record writes based on record generation. The default (NONE)
// indicates that the generation is not used to restrict writes.
//
// The server does not support this field for UDF execute() calls. The read-modify-write
// usage model can still be enforced inside the UDF code itself.
//
// Default: GenerationPolicy.NONE
// indicates that the generation is not used to restrict writes.
GenerationPolicy GenerationPolicy //= GenerationPolicy.NONE;
// Expected generation. Generation is the number of times a record has been modified
// (including creation) on the server. If a write operation is creating a record,
// the expected generation would be 0. This field is only relevant when
// generationPolicy is not NONE.
//
// The server does not support this field for UDF execute() calls. The read-modify-write
// usage model can still be enforced inside the UDF code itself.
//
// Default: 0
Generation uint32
// Expiration determines record expiration in seconds. Also known as TTL (Time-To-Live).
// Seconds record will live before being removed by the server.
// Expiration values:
// TTLServerDefault (0): Default to namespace configuration variable "default-ttl" on the server.
// TTLDontExpire (MaxUint32): Never expire for Aerospike 2 server versions >= 2.7.2 and Aerospike 3+ server
// TTLDontUpdate (MaxUint32 - 1): Do not change ttl when record is written. Supported by Aerospike server versions >= 3.10.1
// > 0: Actual expiration in seconds.
Expiration uint32
// DurableDelete leaves a tombstone for the record if the command results in a record deletion.
// This prevents deleted records from reappearing after node failures.
// Valid for Aerospike Server Enterprise Edition 3.10+ only.
DurableDelete bool
// Execute the write command only if the record is not already locked by this transaction.
// If this field is true and the record is already locked by this transaction, the command
// will return an error with the [types.MRT_ALREADY_LOCKED] error code.
//
// This field is useful for safely retrying non-idempotent writes as an alternative to simply
// aborting the transaction.
//
// Default: false
OnLockingOnly bool
// SendKey determines to whether send user defined key in addition to hash digest on both reads and writes.
// If the key is sent on a write, the key will be stored with the record on
// the server.
// The default is to not send the user defined key.
SendKey bool // = false
}
BatchWritePolicy attributes used in batch write commands.
func NewBatchWritePolicy ¶
func NewBatchWritePolicy() *BatchWritePolicy
NewBatchWritePolicy returns a policy instance for BatchWrite commands.
type Bin ¶
Bin encapsulates a field name/value pair.
type BitOverflowAction ¶
type BitOverflowAction int
BitOverflowAction specifies the action to take when bitwise add/subtract results in overflow/underflow.
const ( // BitOverflowActionFail specifies to fail operation with error. BitOverflowActionFail BitOverflowAction = 0 // BitOverflowActionSaturate specifies that in add/subtract overflows/underflows, set to max/min value. // Example: MAXINT + 1 = MAXINT BitOverflowActionSaturate BitOverflowAction = 2 // BitOverflowActionWrap specifies that in add/subtract overflows/underflows, wrap the value. // Example: MAXINT + 1 = -1 BitOverflowActionWrap BitOverflowAction = 4 )
type BitPolicy ¶
type BitPolicy struct {
// contains filtered or unexported fields
}
BitPolicy determines the Bit operation policy.
func DefaultBitPolicy ¶
func DefaultBitPolicy() *BitPolicy
DefaultBitPolicy will return the default BitPolicy
func NewBitPolicy ¶
NewBitPolicy will return a BitPolicy will provided flags.
type BitResizeFlags ¶
type BitResizeFlags int
BitResizeFlags specifies the bitwise operation flags for resize.
const ( // BitResizeFlagsDefault specifies the default flag. BitResizeFlagsDefault BitResizeFlags = 0 // BitResizeFlagsFromFront Adds/removes bytes from the beginning instead of the end. BitResizeFlagsFromFront BitResizeFlags = 1 // BitResizeFlagsGrowOnly will only allow the []byte size to increase. BitResizeFlagsGrowOnly BitResizeFlags = 2 // BitResizeFlagsShrinkOnly will only allow the []byte size to decrease. BitResizeFlagsShrinkOnly BitResizeFlags = 4 )
type BoolValue ¶
type BoolValue bool
BoolValue encapsulates a boolean value. Supported by Aerospike server v5.6+ only.
func NewBoolValue ¶ added in v8.2.1
NewBoolValue generates a BoolValue instance.
func (BoolValue) EstimateSize ¶
EstimateSize returns the size of the BoolValue in wire protocol.
type BufferEx ¶
type BufferEx interface {
WriteInt64(num int64) int
WriteUint64(num uint64) int
WriteInt32(num int32) int
WriteUint32(num uint32) int
WriteInt16(num int16) int
WriteUint16(num uint16) int
WriteFloat32(float float32) int
WriteFloat64(float float64) int
WriteBool(b bool) int
WriteByte(b byte)
WriteString(s string) (int, Error)
Write(b []byte) (int, Error)
}
BufferEx is a specialized buffer interface for aerospike client.
type BytesValue ¶
type BytesValue []byte
BytesValue encapsulates an array of bytes.
func NewBlobValue ¶
func NewBlobValue(object AerospikeBlob) BytesValue
NewBlobValue accepts an AerospikeBlob interface, and automatically converts it to a BytesValue. If Encode returns an err, it will panic.
func NewBytesValue ¶
func NewBytesValue(bytes []byte) BytesValue
NewBytesValue generates a ByteValue instance.
func (BytesValue) EstimateSize ¶
func (vl BytesValue) EstimateSize() (int, Error)
EstimateSize returns the size of the BytesValue in wire protocol.
func (BytesValue) GetObject ¶
func (vl BytesValue) GetObject() any
GetObject returns original value as an any.
func (BytesValue) GetType ¶
func (vl BytesValue) GetType() int
GetType returns wire protocol value type.
func (BytesValue) String ¶
func (vl BytesValue) String() string
String implements Stringer interface.
type CDTContext ¶
type CDTContext struct {
Id int
Value Value
Expression *Expression
}
CDTContext defines Nested CDT context. Identifies the location of nested list/map to apply the operation. for the current level. An array of CTX identifies location of the list/map on multiple levels on nesting.
func CtxAllChildren ¶ added in v8.6.0
func CtxAllChildren() *CDTContext
CtxAllChildren creates a context that selects all children in a collection. This is useful for applying operations to all elements in a list or map. Equivalent to CTX.allChildren() in Java client.
Example:
ctx := []*CDTContext{
CtxMapKey(StringValue("books")),
CtxAllChildren(), // Select all books
}
func CtxAllChildrenWithFilter ¶ added in v8.6.0
func CtxAllChildrenWithFilter(exp *Expression) *CDTContext
CtxAllChildrenWithFilter creates a context that selects all children in a collection that match the given filter expression. Equivalent to CTX.allChildrenWithFilter() in Java client.
Parameters:
- exp: Filter expression to apply to each child element
Example:
// Select all books with price <= 10.0
filterExp := ExpLessEq(
ExpMapBin("price"),
ExpFloatVal(10.0),
)
ctx := []*CDTContext{
CtxMapKey(StringValue("books")),
CtxAllChildrenWithFilter(filterExp),
}
func CtxAndFilter ¶ added in v8.7.0
func CtxAndFilter(exp *Expression) *CDTContext
CtxAndFilter applies an additional expression filter at the current context level. This creates an AND filter that combines with the preceding context. Entries must satisfy both the preceding context and this filter expression to be included in the result. Typically used after CtxMapKeysIn or other selection contexts to further narrow the results.
Restrictions:
- Only one CtxAndFilter is allowed per context level. Multiple CtxAndFilter calls cannot be chained. To combine multiple conditions, use ExpAnd within a single CtxAndFilter.
- The preceding context entry must not be an expression type (i.e. CtxAndFilter cannot follow CtxAllChildrenWithFilter or CtxAllChildren).
- CtxAndFilter cannot be the first entry in the context chain.
Parameters:
- exp: Filter expression; entries that evaluate to false are excluded
func CtxListIndex ¶
func CtxListIndex(index int) *CDTContext
CtxListIndex creates a context to lookup a list by index offset. If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned.
Index examples: - 0: First item. - 4: Fifth item. - -1: Last item. - -3: Third to last item.
Parameters:
- index: List index position
Example ¶
Demonstrates using context to select a list by index (e.g. first or last item).
key, err := as.NewKey(*namespace, "test", "example-ctx-list-index")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
// order.items[0].productId — build order with items list
order := map[any]any{"items": []any{map[any]any{"productId": "P1"}, map[any]any{"productId": "P2"}}}
_ = client.Put(nil, key, as.BinMap{"order": order})
ctx := []*as.CDTContext{as.CtxMapKey(as.StringValue("items")), as.CtxListIndex(0)}
record, err := client.Operate(nil, key,
as.MapGetByKeyOp("order", "productId", as.MapReturnType.VALUE, ctx...),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["order"])
Output: P1
func CtxListIndexCreate ¶
func CtxListIndexCreate(index int, order ListOrderType, pad bool) *CDTContext
CtxListIndexCreate list with given type at index offset, given an order and pad.
func CtxListRank ¶
func CtxListRank(rank int) *CDTContext
CtxListRank creates a context to lookup a list by rank. 0 = smallest value N = Nth smallest value -1 = largest value
Parameters:
- rank: Rank position (0 = smallest, -1 = largest)
Example ¶
ExampleCtxListRank demonstrates using context to select a list element by index, then get a map key. CtxListRank(0) is "lowest by value" (order for map elements may vary). This example uses CtxListIndex(0) so the first item (productId "low") is selected reliably on any server.
key, err := as.NewKey(*namespace, "test", "example-ctx-list-rank")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
order := map[any]any{"items": []any{map[any]any{"productId": "low"}, map[any]any{"productId": "high"}}}
_ = client.Put(nil, key, as.BinMap{"order": order})
ctx := []*as.CDTContext{as.CtxMapKey(as.StringValue("items")), as.CtxListIndex(0)}
record, err := client.Operate(nil, key,
as.MapGetByKeyOp("order", "productId", as.MapReturnType.VALUE, ctx...),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["order"])
Output: low
func CtxListValue ¶
func CtxListValue(key Value) *CDTContext
CtxListValue defines Lookup list by value.
Example ¶
Demonstrates updating a list element. CtxListValue selects by value
key, err := as.NewKey(*namespace, "test", "example-ctx-list-value")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("scores", 10, 20, 30))
// Update the element at index 1 (value 20) to 21
_, err = client.Operate(nil, key, as.ListSetOp("scores", 1, 21))
if err != nil {
log.Fatal(err)
}
rec, _ := client.Get(nil, key, "scores")
list := rec.Bins["scores"].([]any)
fmt.Println(list[1])
Output: 21
func CtxMapBytesKeysIn
deprecated
added in
v8.7.0
func CtxMapBytesKeysIn(keys ...[]byte) *CDTContext
CtxMapBytesKeysIn selects map entries whose keys are contained in the provided byte slice keys. Can be combined with CtxAndFilter to apply additional filtering on the selected entries.
Deprecated: use CtxMapKeysIn with NewBytesValue per element, e.g.
CtxMapKeysIn(NewBytesValue([]byte{0x01}), NewBytesValue([]byte{0x02}))
func CtxMapIndex ¶
func CtxMapIndex(index int) *CDTContext
CtxMapIndex defines Lookup map by index offset. If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned. Examples: 0: First item. 4: Fifth item. -1: Last item. -3: Third to last item.
Example ¶
Demonstrates using context to select a nested map and get an entry by index. Create the bin with Put so the inner map is stored as a CDT map; then CtxMapKey selects it.
key, err := as.NewKey(*namespace, "test", "example-ctx-map-index")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
// Nested map: bin "data" has key "scores" whose value is a map (must be CDT map for index ops)
data := map[any]any{
"scores": map[any]any{"a": 10, "b": 20, "c": 30},
}
_ = client.Put(nil, key, as.BinMap{"data": data})
// CtxMapKey("scores") selects the inner map; MapGetByIndexOp(..., 0, VALUE) gets first entry's value
ctx := []*as.CDTContext{as.CtxMapKey(as.StringValue("scores"))}
record, err := client.Operate(nil, key, as.MapGetByIndexOp("data", 0, as.MapReturnType.VALUE, ctx...))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["data"])
Output: 10
func CtxMapIntKeysIn
deprecated
added in
v8.7.0
func CtxMapIntKeysIn(keys ...int) *CDTContext
CtxMapIntKeysIn selects map entries whose keys are contained in the provided integer keys. Can be combined with CtxAndFilter to apply additional filtering on the selected entries.
Deprecated: use CtxMapKeysIn with NewIntegerValue or NewLongValue per element, e.g.
CtxMapKeysIn(NewIntegerValue(1), NewIntegerValue(2))
func CtxMapKey ¶
func CtxMapKey(key Value) *CDTContext
CtxMapKey creates a context to lookup a map by key.
Parameters:
- key: The map key to navigate to (use StringValue, IntegerValue, etc.)
Example ¶
Demonstrates using context to navigate into a nested map by key.
key, err := as.NewKey(*namespace, "test", "example-ctx-map-key")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
user := map[any]any{"profile": map[any]any{"address": map[any]any{"city": "NYC"}}}
_ = client.Put(nil, key, as.BinMap{"user": user})
ctx := []*as.CDTContext{as.CtxMapKey(as.StringValue("profile")), as.CtxMapKey(as.StringValue("address"))}
record, err := client.Operate(nil, key,
as.MapGetByKeyOp("user", "city", as.MapReturnType.VALUE, ctx...),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["user"])
Output: NYC
func CtxMapKeyCreate ¶
func CtxMapKeyCreate(key Value, order mapOrderType) *CDTContext
CtxMapKeyCreate creates map with given type at map key.
func CtxMapKeysIn ¶ added in v8.8.0
func CtxMapKeysIn(keys ...Value) *CDTContext
CtxMapKeysIn selects map entries whose keys are contained in the provided value list. Can be combined with CtxAndFilter to apply additional filtering on the selected entries.
Keys may mix CDT-supported types (integer, string, blob) in a single call; element-type validation is deferred to the server (requires server 8.1.2+). Use NewStringValue / NewIntegerValue / NewLongValue / NewBytesValue / NewValue per element, or pass nil to emit a msgpack nil placeholder that the server ignores during key matching.
Example:
ctx := CtxMapKeysIn(
NewStringValue("sku"),
NewLongValue(1001),
NewBytesValue([]byte{'u', 's'}),
)
func CtxMapRank ¶
func CtxMapRank(rank int) *CDTContext
CtxMapRank creates a context to lookup a map by rank. 0 = smallest value N = Nth smallest value -1 = largest value
Parameters:
- rank: Rank position (0 = smallest, -1 = largest)
Example ¶
ExampleCtxMapRank demonstrates using context to reach a nested map and get a value by key. CtxMapRank selects by value rank (requires value-ordered map). This example uses CtxMapKey + MapGetByKeyOp so it runs on any CDT-capable server.
key, err := as.NewKey(*namespace, "test", "example-ctx-map-rank")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
user := map[any]any{"categories": map[any]any{"bronze": 10, "silver": 20, "gold": 30}}
_ = client.Put(nil, key, as.BinMap{"user": user})
// CtxMapKey("categories") selects the inner map; MapGetByKeyOp gets value at key "gold"
ctx := []*as.CDTContext{as.CtxMapKey(as.StringValue("categories"))}
record, err := client.Operate(nil, key,
as.MapGetByKeyOp("user", "gold", as.MapReturnType.VALUE, ctx...),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["user"])
Output: 30
func CtxMapStringKeysIn
deprecated
added in
v8.7.0
func CtxMapStringKeysIn(keys ...string) *CDTContext
CtxMapStringKeysIn selects map entries whose keys are contained in the provided string keys. Can be combined with CtxAndFilter to apply additional filtering on the selected entries.
Deprecated: use CtxMapKeysIn with NewStringValue per element, e.g.
CtxMapKeysIn(NewStringValue("a"), NewStringValue("b"))
func CtxMapValue ¶
func CtxMapValue(value Value) *CDTContext
CtxMapValue defines Lookup map by value.
func (*CDTContext) String ¶
func (ctx *CDTContext) String() string
String implements the Stringer interface for CDTContext
type Client ¶
type Client struct {
// DefaultPolicy is used for all read commands without a specific policy.
DefaultPolicy *BasePolicy
// DefaultBatchPolicy is the default parent policy used in batch read commands. Base policy fields
// include socketTimeout, totalTimeout, maxRetries, etc...
DefaultBatchPolicy *BatchPolicy
// DefaultBatchReadPolicy is the default read policy used in batch operate commands.
DefaultBatchReadPolicy *BatchReadPolicy
// DefaultBatchWritePolicy is the default write policy used in batch operate commands.
// Write policy fields include generation, expiration, durableDelete, etc...
DefaultBatchWritePolicy *BatchWritePolicy
// DefaultBatchDeletePolicy is the default delete policy used in batch delete commands.
DefaultBatchDeletePolicy *BatchDeletePolicy
// DefaultBatchUDFPolicy is the default user defined function policy used in batch UDF execute commands.
DefaultBatchUDFPolicy *BatchUDFPolicy
// DefaultWritePolicy is used for all write commands without a specific policy.
DefaultWritePolicy *WritePolicy
// DefaultScanPolicy is used for all scan commands without a specific policy.
DefaultScanPolicy *ScanPolicy
// DefaultQueryPolicy is used for all query commands without a specific policy.
DefaultQueryPolicy *QueryPolicy
// DefaultAdminPolicy is used for all security commands without a specific policy.
DefaultAdminPolicy *AdminPolicy
// DefaultInfoPolicy is used for all info commands without a specific policy.
DefaultInfoPolicy *InfoPolicy
// Default transaction policy when verifying record versions in a batch on a commit.
DefaultTxnVerifyPolicy *TxnVerifyPolicy
// Default transaction policy when rolling the transaction records forward (commit)
// or back (abort) in a batch.
DefaultTxnRollPolicy *TxnRollPolicy
// contains filtered or unexported fields
}
Client encapsulates an Aerospike cluster. All database operations are available against this object.
func (*Client) Abort ¶
func (clnt *Client) Abort(txn *Txn) (AbortStatus, Error)
Abort and rollback the given multi-record transaction.
Abort is not allowed after an in-doubt mark-roll-forward failure the server may still roll the transaction forward.
Requires server version 8.0+
func (*Client) Add ¶
func (clnt *Client) Add(policy *WritePolicy, key *Key, binMap BinMap) Error
Add adds integer bin values to existing record bin values. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. This call only works for integer values. If the policy is nil, the default relevant policy will be used.
Example ¶
key, err := as.NewKey(*namespace, "test", "addkey")
if err != nil {
log.Fatal(err)
}
if _, err = client.Delete(nil, key); err != nil {
log.Fatal(err)
}
// Add to a non-existing record/bin, should create a record
bin := as.NewBin("bin", 10)
if err = client.AddBins(nil, key, bin); err != nil {
log.Fatal(err)
}
// Add to 5 to the original 10
bin = as.NewBin("bin", 5)
if err = client.AddBins(nil, key, bin); err != nil {
log.Fatal(err)
}
// Check the result
record, err := client.Get(nil, key, bin.Name)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["bin"])
// Demonstrate add and get combined.
bin = as.NewBin("bin", 30)
if record, err = client.Operate(nil, key, as.AddOp(bin), as.GetOp()); err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["bin"])
Output: 15 45
func (*Client) AddBins ¶
func (clnt *Client) AddBins(policy *WritePolicy, key *Key, bins ...*Bin) Error
AddBins works the same as Add, but avoids BinMap allocation and iteration.
func (*Client) Append ¶
func (clnt *Client) Append(policy *WritePolicy, key *Key, binMap BinMap) Error
Append appends bin value's string to existing record bin values. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. This call only works for string and []byte values. If the policy is nil, the default relevant policy will be used.
Example ¶
key, err := as.NewKey(*namespace, "test", "appendkey")
if err != nil {
log.Fatal(err)
}
if _, err = client.Delete(nil, key); err != nil {
log.Fatal(err)
}
// Create by appending to non-existing value
bin1 := as.NewBin("myBin", "Hello")
if err = client.AppendBins(nil, key, bin1); err != nil {
log.Fatal(err)
}
// Append World
bin2 := as.NewBin("myBin", " World")
if err = client.AppendBins(nil, key, bin2); err != nil {
log.Fatal(err)
}
record, err := client.Get(nil, key)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["myBin"])
Output: Hello World
func (*Client) AppendBins ¶
func (clnt *Client) AppendBins(policy *WritePolicy, key *Key, bins ...*Bin) Error
AppendBins works the same as Append, but avoids BinMap allocation and iteration.
func (*Client) BatchDelete ¶
func (clnt *Client) BatchDelete(policy *BatchPolicy, deletePolicy *BatchDeletePolicy, keys []*Key) ([]*BatchRecord, Error)
BatchDelete deletes records for specified keys. If a key is not found, the corresponding result BatchRecord.ResultCode will be types.KEY_NOT_FOUND_ERROR.
Requires server version 6.0+
func (*Client) BatchExecute ¶
func (clnt *Client) BatchExecute(policy *BatchPolicy, udfPolicy *BatchUDFPolicy, keys []*Key, packageName string, functionName string, args ...Value) ([]*BatchRecord, Error)
BatchExecute will read/write multiple records for specified batch keys in one batch call. This method allows different namespaces/bins for each key in the batch. The returned records are located in the same list.
BatchRecord can be *BatchRead, *BatchWrite, *BatchDelete or *BatchUDF.
Requires server version 6.0+
func (*Client) BatchExists ¶
func (clnt *Client) BatchExists(policy *BatchPolicy, keys []*Key) ([]bool, Error)
BatchExists determines if multiple record keys exist in one batch request. The returned boolean array is in positional order with the original key array order. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) BatchGet ¶
func (clnt *Client) BatchGet(policy *BatchPolicy, keys []*Key, binNames ...string) ([]*Record, Error)
BatchGet reads multiple record headers and bins for specified keys in one batch request. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be nil. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) BatchGetComplex ¶
func (clnt *Client) BatchGetComplex(policy *BatchPolicy, records []*BatchRead) Error
BatchGetComplex reads multiple records for specified batch keys in one batch call. This method allows different namespaces/bins to be requested for each key in the batch. The returned records are located in the same list. If the BatchRead key field is not found, the corresponding record field will be nil. The policy can be used to specify timeouts and maximum concurrent goroutines. This method requires Aerospike Server version >= 3.6.0.
func (*Client) BatchGetHeader ¶
func (clnt *Client) BatchGetHeader(policy *BatchPolicy, keys []*Key) ([]*Record, Error)
BatchGetHeader reads multiple record header data for specified keys in one batch request. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be nil. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) BatchGetObjects ¶
func (clnt *Client) BatchGetObjects(policy *BatchPolicy, keys []*Key, objects []any) (found []bool, err Error)
BatchGetObjects reads multiple record headers and bins for specified keys in one batch request. The returned objects are in positional order with the original key array order. If a key is not found, the positional object will not change, and the positional found boolean will be false. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) BatchGetOperate ¶
func (clnt *Client) BatchGetOperate(policy *BatchPolicy, keys []*Key, ops ...*Operation) ([]*Record, Error)
BatchGetOperate reads multiple records for specified keys using read operations in one batch call. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be nil.
If a batch request to a node fails, the entire batch is cancelled.
func (*Client) BatchOperate ¶
func (clnt *Client) BatchOperate(policy *BatchPolicy, records []BatchRecordIfc) Error
BatchOperate will read/write multiple records for specified batch keys in one batch call. This method allows different namespaces/bins for each key in the batch. The returned records are located in the same list.
BatchRecord can be *BatchRead, *BatchWrite, *BatchDelete or *BatchUDF.
Requires server version 6.0+
func (*Client) ChangePassword ¶
func (clnt *Client) ChangePassword(policy *AdminPolicy, user string, password string) Error
ChangePassword changes a user's password. Clear-text password will be hashed using bcrypt before sending to server.
func (*Client) Close ¶
func (clnt *Client) Close()
Close closes all client connections to database server nodes.
func (*Client) Commit ¶
func (clnt *Client) Commit(txn *Txn) (CommitStatus, Error)
Attempt to commit the given multi-record transaction. First, the expected record versions are sent to the server nodes for verification. If all nodes return success, the transaction is committed. Otherwise, the transaction is aborted.
Requires server version 8.0+
func (*Client) CreateComplexIndex ¶
func (clnt *Client) CreateComplexIndex( policy *WritePolicy, namespace string, setName string, indexName string, binName string, indexType IndexType, indexCollectionType IndexCollectionType, ctx ...*CDTContext, ) (*IndexTask, Error)
CreateComplexIndex creates a secondary index, with the ability to put indexes on bin containing complex data types, e.g: Maps and Lists. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned IndexTask instance. This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) CreateIndex ¶
func (clnt *Client) CreateIndex( policy *WritePolicy, namespace string, setName string, indexName string, binName string, indexType IndexType, ) (*IndexTask, Error)
CreateIndex creates a secondary index. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned IndexTask instance. This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) CreateIndexWithExpression ¶ added in v8.3.0
func (clnt *Client) CreateIndexWithExpression( policy *WritePolicy, namespace string, setName string, indexName string, indexType IndexType, indexCollectionType IndexCollectionType, expression *Expression, ) (*IndexTask, Error)
CreateIndexWithExpression creates a secondary index with expressions. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned IndexTask instance. This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) CreatePKIUser ¶ added in v8.3.0
func (clnt *Client) CreatePKIUser(policy *AdminPolicy, user string, roles []string) Error
CreatePKIUser creates a new user PKI user with roles. PKI users are authenticated via TLS and a certificate instead of a password. Supported by Aerospike Server v8.1+ Enterprise.
func (*Client) CreateRole ¶
func (clnt *Client) CreateRole(policy *AdminPolicy, roleName string, privileges []Privilege, whitelist []string, readQuota, writeQuota uint32) Error
CreateRole creates a user-defined role. Quotas require server security configuration "enable-quotas" to be set to true. Pass 0 for quota values for no limit.
func (*Client) CreateSetIndex ¶ added in v8.7.0
func (clnt *Client) CreateSetIndex( policy *WritePolicy, namespace string, setName string, indexName string, ) (*IndexTask, Error)
CreateSetIndex creates a set index for the given namespace and set. A set index is a secondary index specialized for record presence per set; no bin, type, context, or expression parameters are used. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned IndexTask instance. Requires server version 8.1.2+. If the policy is nil, the default relevant policy will be used.
func (*Client) CreateUser ¶
func (clnt *Client) CreateUser(policy *AdminPolicy, user string, password string, roles []string) Error
CreateUser creates a new user with password and roles. Clear-text password will be hashed using bcrypt before sending to server.
func (*Client) Delete ¶
func (clnt *Client) Delete(policy *WritePolicy, key *Key) (bool, Error)
Delete deletes a record for specified key. The policy specifies the command timeout. If the policy is nil, the default relevant policy will be used.
func (*Client) DisableMetrics ¶
func (clnt *Client) DisableMetrics()
DisableMetrics disables the cluster command metrics gathering.
func (*Client) DropIndex ¶
func (clnt *Client) DropIndex( policy *WritePolicy, namespace string, setName string, indexName string, ) Error
DropIndex deletes a secondary index. It will block until index is dropped on all nodes. This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) DropRole ¶
func (clnt *Client) DropRole(policy *AdminPolicy, roleName string) Error
DropRole removes a user-defined role.
func (*Client) DropUser ¶
func (clnt *Client) DropUser(policy *AdminPolicy, user string) Error
DropUser removes a user from the cluster.
func (*Client) EnableMetrics ¶
func (clnt *Client) EnableMetrics(policy *MetricsPolicy)
EnableMetrics enables the cluster command metrics gathering. If the parameters for the histogram in the policy are different from the one already on the cluster, the metrics will be reset.
func (*Client) Execute ¶
func (clnt *Client) Execute(policy *WritePolicy, key *Key, packageName string, functionName string, args ...Value) (any, Error)
Execute executes a user defined function on server and return results. The function operates on a single record. The package name is used to locate the udf file location:
udf file = <server udf dir>/<package name>.lua
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) ExecuteUDF ¶
func (clnt *Client) ExecuteUDF(policy *QueryPolicy, statement *Statement, packageName string, functionName string, functionArgs ...Value, ) (*ExecuteTask, Error)
ExecuteUDF applies user defined function on records that match the statement filter. Records are not returned to the client. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned ExecuteTask instance.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) ExecuteUDFNode ¶
func (clnt *Client) ExecuteUDFNode(policy *QueryPolicy, node *Node, statement *Statement, packageName string, functionName string, functionArgs ...Value, ) (*ExecuteTask, Error)
ExecuteUDFNode applies user defined function on records that match the statement filter on the specified node. Records are not returned to the client. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned ExecuteTask instance.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) Exists ¶
func (clnt *Client) Exists(policy *BasePolicy, key *Key) (bool, Error)
Exists determine if a record key exists. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) Get ¶
Get reads a record header and bins for specified key. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) GetDefaultAdminPolicy ¶
func (clnt *Client) GetDefaultAdminPolicy() *AdminPolicy
GetDefaultAdminPolicy returns corresponding default policy from the client
func (*Client) GetDefaultBatchDeletePolicy ¶
func (clnt *Client) GetDefaultBatchDeletePolicy() *BatchDeletePolicy
GetDefaultBatchDeletePolicy returns corresponding default policy from the client
func (*Client) GetDefaultBatchPolicy ¶
func (clnt *Client) GetDefaultBatchPolicy() *BatchPolicy
GetDefaultBatchPolicy returns corresponding default policy from the client
func (*Client) GetDefaultBatchReadPolicy ¶
func (clnt *Client) GetDefaultBatchReadPolicy() *BatchReadPolicy
GetDefaultBatchReadPolicy returns corresponding default policy from the client
func (*Client) GetDefaultBatchUDFPolicy ¶
func (clnt *Client) GetDefaultBatchUDFPolicy() *BatchUDFPolicy
GetDefaultBatchUDFPolicy returns corresponding default policy from the client
func (*Client) GetDefaultBatchWritePolicy ¶
func (clnt *Client) GetDefaultBatchWritePolicy() *BatchWritePolicy
GetDefaultBatchWritePolicy returns corresponding default policy from the client
func (*Client) GetDefaultInfoPolicy ¶
func (clnt *Client) GetDefaultInfoPolicy() *InfoPolicy
GetDefaultInfoPolicy returns corresponding default policy from the client
func (*Client) GetDefaultPolicy ¶
func (clnt *Client) GetDefaultPolicy() *BasePolicy
GetDefaultPolicy returns corresponding default policy from the client
func (*Client) GetDefaultQueryPolicy ¶
func (clnt *Client) GetDefaultQueryPolicy() *QueryPolicy
GetDefaultQueryPolicy returns corresponding default policy from the client
func (*Client) GetDefaultScanPolicy ¶
func (clnt *Client) GetDefaultScanPolicy() *ScanPolicy
GetDefaultScanPolicy returns corresponding default policy from the client
func (*Client) GetDefaultTxnRollPolicy ¶
func (clnt *Client) GetDefaultTxnRollPolicy() *TxnRollPolicy
GetDefaultTxnRollPolicy returns corresponding default policy from the client
func (*Client) GetDefaultTxnVerifyPolicy ¶
func (clnt *Client) GetDefaultTxnVerifyPolicy() *TxnVerifyPolicy
GetDefaultTxnVerifyPolicy returns corresponding default policy from the client
func (*Client) GetDefaultWritePolicy ¶
func (clnt *Client) GetDefaultWritePolicy() *WritePolicy
GetDefaultWritePolicy returns corresponding default policy from the client
func (*Client) GetHeader ¶
func (clnt *Client) GetHeader(policy *BasePolicy, key *Key) (*Record, Error)
GetHeader reads a record generation and expiration only for specified key. Bins are not read. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) GetNodeNames ¶
GetNodeNames returns a list of active server node names in the cluster.
func (*Client) GetObject ¶
func (clnt *Client) GetObject(policy *BasePolicy, key *Key, obj any) Error
GetObject reads a record for specified key and puts the result into the provided object. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) GrantPrivileges ¶
func (clnt *Client) GrantPrivileges(policy *AdminPolicy, roleName string, privileges []Privilege) Error
GrantPrivileges grant privileges to a user-defined role.
func (*Client) GrantRoles ¶
func (clnt *Client) GrantRoles(policy *AdminPolicy, user string, roles []string) Error
GrantRoles adds roles to user's list of roles.
func (*Client) IsConnected ¶
IsConnected determines if the client is ready to talk to the database server cluster.
func (*Client) ListUDF ¶
func (clnt *Client) ListUDF(policy *BasePolicy) ([]*UDF, Error)
ListUDF lists all packages containing user defined functions in the server. This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) MetricsEnabled ¶
MetricsEnabled returns true if metrics are enabled for the cluster.
func (*Client) Operate ¶
func (clnt *Client) Operate(policy *WritePolicy, key *Key, operations ...*Operation) (*Record, Error)
Operate performs multiple read/write operations on a single key in one batch request. An example would be to add an integer value to an existing record and then read the result, all in one database call.
If the policy is nil, the default relevant policy will be used.
func (*Client) Prepend ¶
func (clnt *Client) Prepend(policy *WritePolicy, key *Key, binMap BinMap) Error
Prepend prepends bin value's string to existing record bin values. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. This call works only for string and []byte values. If the policy is nil, the default relevant policy will be used.
func (*Client) PrependBins ¶
func (clnt *Client) PrependBins(policy *WritePolicy, key *Key, bins ...*Bin) Error
PrependBins works the same as Prepend, but avoids BinMap allocation and iteration.
func (*Client) Put ¶
func (clnt *Client) Put(policy *WritePolicy, key *Key, binMap BinMap) Error
Put writes record bin(s) to the server. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. If the policy is nil, the default relevant policy will be used.
func (*Client) PutBins ¶
func (clnt *Client) PutBins(policy *WritePolicy, key *Key, bins ...*Bin) Error
PutBins writes record bin(s) to the server. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. This method avoids using the BinMap allocation and iteration and is lighter on GC. If the policy is nil, the default relevant policy will be used.
func (*Client) PutObject ¶
func (clnt *Client) PutObject(policy *WritePolicy, key *Key, obj any) (err Error)
PutObject writes record bin(s) to the server. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. If the policy is nil, the default relevant policy will be used. A struct can be tagged to influence the way the object is put in the database:
type Person struct {
TTL uint32 `asm:"ttl"`
RecGen uint32 `asm:"gen"`
Name string `as:"name"`
Address string `as:"desc,omitempty"`
Age uint8 `as:",omitempty"`
Password string `as:"-"`
}
Tag `as:` denotes Aerospike fields. The first value will be the alias for the field. `,omitempty` (without any spaces between the comma and the word) will act like the json package, and will not send the value of the field to the database if the value is zero value. Tag `asm:` denotes Aerospike Meta fields, and includes ttl and generation values. If a tag is marked with `-`, it will not be sent to the database at all. Note: Tag `as` can be replaced with any other user-defined tag via the function `SetAerospikeTag`.
func (*Client) PutPayload ¶
func (clnt *Client) PutPayload(policy *WritePolicy, key *Key, payload []byte) Error
PutPayload writes the raw write/delete payload to the server. The policy specifies the transaction timeout. If the policy is nil, the default relevant policy will be used.
func (*Client) Query ¶
func (clnt *Client) Query(policy *QueryPolicy, statement *Statement) (*Recordset, Error)
Query executes a query and returns a Recordset. The query executor puts records on the channel from separate goroutines. The caller can concurrently pop records off the channel through the Recordset.Records channel.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryAggregate ¶
func (clnt *Client) QueryAggregate(policy *QueryPolicy, statement *Statement, packageName, functionName string, functionArgs ...Value) (*Recordset, Error)
QueryAggregate executes a Map/Reduce query and returns the results. The query executor puts records on the channel from separate goroutines. The caller can concurrently pop records off the channel through the Recordset.Records channel.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryExecute ¶
func (clnt *Client) QueryExecute(policy *QueryPolicy, writePolicy *WritePolicy, statement *Statement, ops ...*Operation, ) (*ExecuteTask, Error)
QueryExecute applies operations on records that match the statement filter. Records are not returned to the client. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned ExecuteTask instance.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryNode ¶
func (clnt *Client) QueryNode(policy *QueryPolicy, node *Node, statement *Statement) (*Recordset, Error)
QueryNode executes a query on a specific node and returns a recordset. The caller can concurrently pop records off the channel through the record channel.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryNodeObjects ¶
func (clnt *Client) QueryNodeObjects(policy *QueryPolicy, node *Node, statement *Statement, objChan any) (*Recordset, Error)
QueryNodeObjects executes a query on a specific node and marshals the records into the given channel. The caller can concurrently pop records off the channel.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryObjects ¶
func (clnt *Client) QueryObjects(policy *QueryPolicy, statement *Statement, objChan any) (*Recordset, Error)
QueryObjects executes a query on all nodes in the cluster and marshals the records into the given channel. The query executor puts records on the channel from separate goroutines. The caller can concurrently pop objects.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryPartitionObjects ¶
func (clnt *Client) QueryPartitionObjects(policy *QueryPolicy, statement *Statement, objChan any, partitionFilter *PartitionFilter) (*Recordset, Error)
QueryPartitionObjects executes a query for specified partitions and returns a recordset. The query executor puts records on the channel from separate goroutines. The caller can concurrently pop records off the channel through the Recordset.Records channel.
This method is only supported by Aerospike 4.9+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryPartitions ¶
func (clnt *Client) QueryPartitions(policy *QueryPolicy, statement *Statement, partitionFilter *PartitionFilter) (*Recordset, Error)
QueryPartitions executes a query for specified partitions and returns a recordset. The query executor puts records on the channel from separate goroutines. The caller can concurrently pop records off the channel through the Recordset.Records channel.
This method is only supported by Aerospike 4.9+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryRole ¶
func (clnt *Client) QueryRole(policy *AdminPolicy, role string) (res *Role, err Error)
QueryRole retrieves privileges for a given role.
func (*Client) QueryRoles ¶
func (clnt *Client) QueryRoles(policy *AdminPolicy) (res []*Role, err Error)
QueryRoles retrieves all roles and their privileges.
func (*Client) QueryUser ¶
func (clnt *Client) QueryUser(policy *AdminPolicy, user string) (res *UserRoles, err Error)
QueryUser retrieves roles for a given user.
func (*Client) QueryUsers ¶
func (clnt *Client) QueryUsers(policy *AdminPolicy) (res []*UserRoles, err Error)
QueryUsers retrieves all users and their roles.
func (*Client) RegisterUDF ¶
func (clnt *Client) RegisterUDF(policy *WritePolicy, udfBody []byte, serverPath string, language Language) (*RegisterTask, Error)
RegisterUDF registers a package containing user defined functions with server. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RegisterTask instance.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) RegisterUDFFromFile ¶
func (clnt *Client) RegisterUDFFromFile(policy *WritePolicy, clientPath string, serverPath string, language Language) (*RegisterTask, Error)
RegisterUDFFromFile reads a file from file system and registers the containing a package user defined functions with the server. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RegisterTask instance.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) RemoveUDF ¶
func (clnt *Client) RemoveUDF(policy *WritePolicy, udfName string) (*RemoveTask, Error)
RemoveUDF removes a package containing user defined functions in the server. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RemoveTask instance.
This method is only supported by Aerospike 3+ servers. If the policy is nil, the default relevant policy will be used.
func (*Client) RevokePrivileges ¶
func (clnt *Client) RevokePrivileges(policy *AdminPolicy, roleName string, privileges []Privilege) Error
RevokePrivileges revokes privileges from a user-defined role.
func (*Client) RevokeRoles ¶
func (clnt *Client) RevokeRoles(policy *AdminPolicy, user string, roles []string) Error
RevokeRoles removes roles from user's list of roles.
func (*Client) ScanAll ¶
func (clnt *Client) ScanAll(apolicy *ScanPolicy, namespace string, setName string, binNames ...string) (*Recordset, Error)
ScanAll reads all records in specified namespace and set from all nodes. If the policy's concurrentNodes is specified, each server node will be read in parallel. Otherwise, server nodes are read sequentially. If the policy is nil, the default relevant policy will be used.
func (*Client) ScanAllObjects ¶
func (clnt *Client) ScanAllObjects(apolicy *ScanPolicy, objChan any, namespace string, setName string, binNames ...string) (*Recordset, Error)
ScanAllObjects reads all records in specified namespace and set from all nodes. If the policy's concurrentNodes is specified, each server node will be read in parallel. Otherwise, server nodes are read sequentially. If the policy is nil, the default relevant policy will be used.
func (*Client) ScanNode ¶
func (clnt *Client) ScanNode(apolicy *ScanPolicy, node *Node, namespace string, setName string, binNames ...string) (*Recordset, Error)
ScanNode reads all records in specified namespace and set for one node only. If the policy is nil, the default relevant policy will be used.
func (*Client) ScanNodeObjects ¶
func (clnt *Client) ScanNodeObjects(apolicy *ScanPolicy, node *Node, objChan any, namespace string, setName string, binNames ...string) (*Recordset, Error)
ScanNodeObjects reads all records in specified namespace and set for one node only, and marshalls the results into the objects of the provided channel in Recordset. If the policy is nil, the default relevant policy will be used. The resulting records will be marshalled into the objChan. objChan will be closed after all the records are read.
func (*Client) ScanPartitionObjects ¶
func (clnt *Client) ScanPartitionObjects(apolicy *ScanPolicy, objChan any, partitionFilter *PartitionFilter, namespace string, setName string, binNames ...string) (*Recordset, Error)
ScanPartitionObjects Reads records in specified namespace, set and partition filter. If the policy's concurrentNodes is specified, each server node will be read in parallel. Otherwise, server nodes are read sequentially. If partitionFilter is nil, all partitions will be scanned. If the policy is nil, the default relevant policy will be used. This method is only supported by Aerospike 4.9+ servers.
func (*Client) ScanPartitions ¶
func (clnt *Client) ScanPartitions(apolicy *ScanPolicy, partitionFilter *PartitionFilter, namespace string, setName string, binNames ...string) (*Recordset, Error)
ScanPartitions Read records in specified namespace, set and partition filter. If the policy's concurrentNodes is specified, each server node will be read in parallel. Otherwise, server nodes are read sequentially. If partitionFilter is nil, all partitions will be scanned. If the policy is nil, the default relevant policy will be used. This method is only supported by Aerospike 4.9+ servers.
func (*Client) SetDefaultAdminPolicy ¶
func (clnt *Client) SetDefaultAdminPolicy(policy *AdminPolicy)
SetDefaultAdminPolicy sets corresponding default policy on the client
func (*Client) SetDefaultBatchDeletePolicy ¶
func (clnt *Client) SetDefaultBatchDeletePolicy(policy *BatchDeletePolicy)
SetDefaultBatchDeletePolicy sets corresponding default policy on the client
func (*Client) SetDefaultBatchPolicy ¶
func (clnt *Client) SetDefaultBatchPolicy(policy *BatchPolicy)
SetDefaultBatchPolicy sets corresponding default policy on the client
func (*Client) SetDefaultBatchReadPolicy ¶
func (clnt *Client) SetDefaultBatchReadPolicy(policy *BatchReadPolicy)
SetDefaultBatchReadPolicy sets corresponding default policy on the client
func (*Client) SetDefaultBatchUDFPolicy ¶
func (clnt *Client) SetDefaultBatchUDFPolicy(policy *BatchUDFPolicy)
SetDefaultBatchUDFPolicy sets corresponding default policy on the client
func (*Client) SetDefaultBatchWritePolicy ¶
func (clnt *Client) SetDefaultBatchWritePolicy(policy *BatchWritePolicy)
SetDefaultBatchWritePolicy sets corresponding default policy on the client
func (*Client) SetDefaultInfoPolicy ¶
func (clnt *Client) SetDefaultInfoPolicy(policy *InfoPolicy)
SetDefaultInfoPolicy sets corresponding default policy on the client
func (*Client) SetDefaultPolicy ¶
func (clnt *Client) SetDefaultPolicy(policy *BasePolicy)
SetDefaultPolicy sets corresponding default policy on the client
func (*Client) SetDefaultQueryPolicy ¶
func (clnt *Client) SetDefaultQueryPolicy(policy *QueryPolicy)
SetDefaultQueryPolicy sets corresponding default policy on the client
func (*Client) SetDefaultScanPolicy ¶
func (clnt *Client) SetDefaultScanPolicy(policy *ScanPolicy)
SetDefaultScanPolicy sets corresponding default policy on the client
func (*Client) SetDefaultTxnRollPolicy ¶
func (clnt *Client) SetDefaultTxnRollPolicy(policy *TxnRollPolicy)
SetDefaultTxnRollPolicy sets corresponding default policy on the client
func (*Client) SetDefaultTxnVerifyPolicy ¶
func (clnt *Client) SetDefaultTxnVerifyPolicy(policy *TxnVerifyPolicy)
SetDefaultTxnVerifyPolicy sets corresponding default policy on the client
func (*Client) SetDefaultWritePolicy ¶
func (clnt *Client) SetDefaultWritePolicy(policy *WritePolicy)
SetDefaultWritePolicy sets corresponding default policy on the client
func (*Client) SetQuotas ¶
func (clnt *Client) SetQuotas(policy *AdminPolicy, roleName string, readQuota, writeQuota uint32) Error
SetQuotas sets maximum reads/writes per second limits for a role. If a quota is zero, the limit is removed. Quotas require server security configuration "enable-quotas" to be set to true. Pass 0 for quota values for no limit.
func (*Client) SetWhitelist ¶
func (clnt *Client) SetWhitelist(policy *AdminPolicy, roleName string, whitelist []string) Error
SetWhitelist sets IP address whitelist for a role. If whitelist is nil or empty, it removes existing whitelist from role.
func (*Client) SetXDRFilter ¶
func (clnt *Client) SetXDRFilter(policy *InfoPolicy, datacenter string, namespace string, filter *Expression) Error
SetXDRFilter sets XDR filter for given datacenter name and namespace. The expression filter indicates which records XDR should ship to the datacenter. Pass nil as filter to remove the current filter on the server.
func (*Client) Stats ¶
Stats returns internal statistics regarding the inner state of the client and the cluster.
func (*Client) Touch ¶
func (clnt *Client) Touch(policy *WritePolicy, key *Key) Error
Touch updates a record's metadata. If the record exists, the record's TTL will be reset to the policy's expiration. If the record does not exist, it can't be created because the server deletes empty records. If the record doesn't exist, it will return an error.
func (*Client) Truncate ¶
func (clnt *Client) Truncate(policy *InfoPolicy, namespace, set string, beforeLastUpdate *time.Time) Error
Truncate removes records in specified namespace/set efficiently. This method is many orders of magnitude faster than deleting records one at a time. Works with Aerospike Server versions >= 3.12. This asynchronous server call may return before the truncation is complete. The user can still write new records after the server call returns because new records will have last update times greater than the truncate cutoff (set at the time of truncate call). For more information, See https://www.aerospike.com/docs/reference/info#truncate
func (*Client) WarmUp ¶
WarmUp fills the connection pool with connections for all nodes. This is necessary on startup for high traffic programs. If the count is <= 0, the connection queue will be filled. If the count is more than the size of the pool, the pool will be filled. Note: One connection per node is reserved for tend operations and is not used for transactions.
type ClientPolicy ¶
type ClientPolicy struct {
// AuthMode specifies authentication mode used when user/password is defined. It is set to AuthModeInternal by default.
AuthMode AuthMode
// User authentication to cluster. Leave empty for clusters running without restricted access.
User string
// Password authentication to cluster. The password will be stored by the client and sent to server
// in hashed format. Leave empty for clusters running without restricted access.
Password string
// ClusterName sets the expected cluster ID. If not nil, server nodes must return this cluster ID in order to
// join the client's view of the cluster. Should only be set when connecting to servers that
// support the "cluster-name" info command. (v3.10+)
ClusterName string //=""
// Initial host connection timeout duration. The timeout when opening a connection
// to the server host for the first time.
Timeout time.Duration //= 30 seconds
// Connection idle timeout. Every time a connection is used, its idle
// deadline will be extended by this duration. When this deadline is reached,
// the connection will be closed and discarded from the connection pool.
// The value is limited to 24 hours (86400s).
//
// It's important to set this value to a few seconds less than the server's proto-fd-idle-ms
// (default 60000 milliseconds or 1 minute), so the client does not attempt to use a socket
// that has already been reaped by the server.
//
// Connection pools are now implemented by a LIFO stack. Connections at the tail of the
// stack will always be the least used. These connections are checked for IdleTimeout
// on every tend (usually 1 second).
//
// Servers 8.1+ have deprecated proto-fd-idle-ms. When proto-fd-idle-ms is ultimately removed,
// the server will stop automatically reaping based on socket idle timeouts.
//
// Default: 0 seconds
IdleTimeout time.Duration //= 0 seconds
// LoginTimeout specifies the timeout for login operation for external authentication such as LDAP.
LoginTimeout time.Duration //= 10 seconds
// ConnectionQueueCache specifies the size of the Connection Queue cache PER NODE.
// Note: One connection per node is reserved for tend operations and is not used for transactions.
ConnectionQueueSize int //= 100
// MinConnectionsPerNode specifies the minimum number of synchronous connections allowed per server node.
// Preallocate min connections on client node creation.
// The client will periodically allocate new connections if count falls below min connections.
//
// Server proto-fd-idle-ms may also need to be increased substantially if min connections are defined.
// The proto-fd-idle-ms default directs the server to close connections that are idle for 60 seconds
// which can defeat the purpose of keeping connections in reserve for a future burst of activity.
//
// If server proto-fd-idle-ms is changed, client ClientPolicy.IdleTimeout should also be
// changed to be a few seconds less than proto-fd-idle-ms.
//
// Servers 8.1+ have deprecated proto-fd-idle-ms. When proto-fd-idle-ms is ultimately removed,
// the server will stop automatically reaping based on socket idle timeouts.
//
// Default: 0
MinConnectionsPerNode int
// MaxErrorRate defines the maximum number of errors allowed per node per ErrorRateWindow before
// the circuit-breaker algorithm returns MAX_ERROR_RATE on database commands to that node.
// If MaxErrorRate is zero, there is no error limit and
// the exception will never be thrown.
//
// The counted error types are any error that causes the connection to close (socket errors
// and client timeouts) and types.ResultCode.DEVICE_OVERLOAD.
//
// Default: 100
MaxErrorRate int
// ErrorRateWindow defined the number of cluster tend iterations that defines the window for MaxErrorRate.
// One tend iteration is defined as TendInterval plus the time to tend all nodes.
// At the end of the window, the error count is reset to zero and backoff state is removed
// on all nodes.
//
// Default: 1
ErrorRateWindow int //= 1
// If set to true, will not create a new connection
// to the node if there are already `ConnectionQueueSize` active connections.
// Note: One connection per node is reserved for tend operations and is not used for transactions.
LimitConnectionsToQueueSize bool //= true
// Number of connections allowed to established at the same time.
// This value does not limit the number of connections. It just
// puts a threshold on the number of parallel opening connections.
// By default, there are no limits.
OpeningConnectionThreshold int // 0
// Throw exception if host connection fails during addHost().
FailIfNotConnected bool //= true
// TendInterval determines interval for checking for cluster state changes.
// Minimum possible interval is 10 Milliseconds.
TendInterval time.Duration //= 1 second
// IpMap translates server-advertised addresses into client-reachable ones. It is
// used when client and server sit on different networks (e.g. an on-prem client
// reaching a cloud cluster through a load balancer), so the internal address a node
// advertises during discovery can be rewritten into an address the client can
// actually connect to. Default is nil (no translation).
//
// The key is the host (no port) the server advertises. The value is the address the
// client should use instead: either "host" (port preserved, matching the Java and C
// clients) or "host:port" (host and port both replaced — needed when several nodes
// sit behind one load-balancer hostname and are distinguished only by port). A
// missing key leaves the address unchanged. It is applied on both the
// seed/service-address path (node_validator.go) and the peers path (peers_parser.go).
//
// NOTE: IpMap/NLB fork change. Stock declares this identical field but never
// applies it (dead since the 2021 addFriends removal); this fork re-wires it and
// additionally accepts "host:port" values.
IpMap map[string]string
// UseServicesAlternate determines if the client should use "services-alternate" instead of "services"
// in info request during cluster tending.
//"services-alternate" returns server configured external IP addresses that client
// uses to talk to nodes. "services-alternate" can be used in place of providing a client "ipMap".
// This feature is recommended instead of using the client-side IpMap above.
//
// "services-alternate" is available with Aerospike Server versions >= 3.7.1.
//
// Info command to use whether UserServicesAlternate is true or false:
//
// If false, use:
// IP address: service-clear-std
// TLS IP address: service-tls-std
// Peers addresses: peers-clear-std
// Peers TLS addresses: peers-tls-std
// If true, use:
// IP address: service-clear-alt
// TLS IP address: service-tls-alt
// Peers addresses: peers-clear-alt
// Peers TLS addresses: peers-tls-alt
UseServicesAlternate bool // false
// RackAware directs the client to update rack information on intervals.
// When this feature is enabled, the client will prefer to use nodes which reside
// on the same rack as the client for read transactions. The application should also set the RackId, and
// use the ReplicaPolicy.PREFER_RACK for reads.
// This feature is in particular useful if the cluster is in the cloud and the cloud provider
// is charging for network bandwidth out of the zone. Keep in mind that the node on the same rack
// may not be the Master, and as such the data may be stale. This setting is particularly usable
// for clusters that are read heavy.
RackAware bool // false
// RackIds defines the list of acceptable racks in order of preference. Nodes in RackIds[0] are chosen first.
// If a node is not found in rackIds[0], then nodes in rackIds[1] are searched, and so on.
// If rackIds is set, ClientPolicy.RackId is ignored.
//
// ClientPolicy.RackAware, ReplicaPolicy.PREFER_RACK and server rack
// configuration must also be set to enable this functionality.
RackIds []int // nil
// TlsConfig specifies TLS secure connection policy for TLS enabled servers.
// For better performance, we suggest preferring the server-side ciphers by
// setting PreferServerCipherSuites = true.
TlsConfig *tls.Config //= nil
// IgnoreOtherSubnetAliases helps to ignore aliases that are outside main subnet
IgnoreOtherSubnetAliases bool //= false
// SeedOnlyCluster enforces the client to use only the seed addresses.
// Peers nodes for the cluster are not discovered and seed nodes are
// retained despite connection failures.
SeedOnlyCluster bool // = false
// Application id is used to identify application so that client operations can be correlated
// with server side metrics.
ApplicationId string
// Determianes the interval for checking for configuration changes using configProvider.
ConfigInterval time.Duration // = 5 second
// ValidateUTF8 enables a pre-write check that every string value sent in a
// write operation contains only valid UTF-8 bytes. Default: false.
//
// Go's string type is a sequence of bytes and is not type-enforced to be
// valid UTF-8. The Aerospike wire protocol and server-side string
// operations (introduced in server 8.2.0) assume string particles are
// valid UTF-8: invalid bytes cause silently wrong results in some ops
// (e.g. StrLen, StrSubstr, StrInsert, StrPadStart) and PARAMETER_ERROR
// in others (e.g. StrUpper, StrFind, StrRegexReplace).
//
// When enabled, writes containing invalid UTF-8 fail fast with
// PARAMETER_ERROR before being sent to the server. The check is O(n)
// per string and short-circuits on ASCII via unicode/utf8.ValidString.
//
// Default is false for backward compatibility — applications may today
// rely on round-tripping arbitrary bytes through string bins. New
// applications and any caller that touches string operations should
// set this to true.
ValidateUTF8 bool //= false
}
ClientPolicy encapsulates parameters for client policy command.
func NewClientPolicy ¶
func NewClientPolicy() *ClientPolicy
NewClientPolicy generates a new ClientPolicy with default values.
func (*ClientPolicy) RequiresAuthentication ¶
func (cp *ClientPolicy) RequiresAuthentication() bool
RequiresAuthentication returns true if a User or Password is set for ClientPolicy.
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster encapsulates the aerospike cluster nodes and manages them.
func (*Cluster) AddSeeds ¶
AddSeeds adds new hosts to the cluster. They will be added to the cluster on next tend call.
func (*Cluster) ClientPolicy ¶
func (clstr *Cluster) ClientPolicy() (res ClientPolicy)
ClientPolicy returns the client policy that is currently used with the cluster.
func (*Cluster) Close ¶
func (clstr *Cluster) Close()
Close closes all cached connections to the cluster nodes and stops the tend goroutine.
func (*Cluster) DisableMetrics ¶
func (clstr *Cluster) DisableMetrics()
DisableMetrics disables the cluster command metrics gathering.
func (*Cluster) EnableMetrics ¶
func (clstr *Cluster) EnableMetrics(policy *MetricsPolicy)
EnableMetrics enables the cluster command metrics gathering. If the parameters for the histogram in the policy are the different from the one already on the cluster, the metrics will be reset.
func (*Cluster) GetAliases ¶
GetAliases returns a list of all node aliases in the cluster
func (*Cluster) GetNodeByName ¶
GetNodeByName finds a node by name and returns an error if the node is not found.
func (*Cluster) GetRandomNode ¶
GetRandomNode returns a random node on the cluster
func (*Cluster) GetSeedCount ¶
GetSeedCount is the count of seed nodes
func (*Cluster) IsConnected ¶
IsConnected returns true if cluster has nodes and is not already closed.
func (*Cluster) MetricsEnabled ¶
MetricsEnabled returns true if metrics are enabled for the cluster.
func (*Cluster) MetricsPolicy ¶
func (clstr *Cluster) MetricsPolicy() *MetricsPolicy
MetricsEnabled returns true if metrics are enabled for the cluster.
func (*Cluster) MigrationInProgress ¶
MigrationInProgress determines if any node in the cluster is participating in a data migration
func (*Cluster) WaitUntilMigrationIsFinished ¶ added in v8.3.0
WaitUntilMigrationIsFinished will block until all migration operations in the cluster all finished.
func (*Cluster) WarmUp ¶
WarmUp fills the connection pool with connections for all nodes. This is necessary on startup for high traffic programs. If the count is <= 0, the connection queue will be filled. If the count is more than the size of the pool, the pool will be filled. Note: One connection per node is reserved for tend operations and is not used for transactions.
type CommitError ¶
type CommitError string
Transaction error status.
const ( CommitErrorVerifyFail CommitError = "Transaction verify failed. Transaction aborted." CommitErrorVerifyFailCloseAbandoned CommitError = "" /* 129-byte string literal not displayed */ CommitErrorVerifyFailAbortAbandoned CommitError = "Transaction verify failed. Transaction client abort abandoned. Server will eventually abort the Transaction." CommitErrorMarkRollForwardAbandoned CommitError = "Transaction client mark roll forward abandoned. Server will eventually abort the Transaction." )
type CommitLevel ¶
type CommitLevel int
CommitLevel indicates the desired consistency guarantee when committing a command on the server.
const ( // COMMIT_ALL indicates the server should wait until successfully committing master and all replicas. COMMIT_ALL CommitLevel = iota // COMMIT_MASTER indicates the server should wait until successfully committing master only. COMMIT_MASTER )
type CommitStatus ¶
type CommitStatus string
Transaction commit status code.
const ( CommitStatusOK CommitStatus = "Commit succeeded" CommitStatusUnverified CommitStatus = "Commit process was disrupted on client side and unverified" CommitStatusAlreadyCommitted CommitStatus = "Already committed" CommitStatusAlreadyAborted CommitStatus = "Already aborted" CommitStatusMarkRollForwardAbandoned CommitStatus = "Transaction client mark roll forward abandoned. Server will eventually abort the Transaction." CommitStatusRollForwardAbandoned CommitStatus = "Transaction client roll forward abandoned. Server will eventually commit the Transaction." CommitStatusCloseAbandoned CommitStatus = "" /* 126-byte string literal not displayed */ )
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a connection with a timeout. Connections maintain a buffer to minimize requesting buffers from the pool. If a returned record requires a bigger buffer, the connection will borrow a larger buffer from the pool and temporarily use it, returning it after the request. A histogram keeps track of the sizes of buffers used for the connection, and the median value is used to resize the connection buffer on intervals to optimize memory usage and minimize GC pressure.
func (*Connection) IsConnected ¶
func (ctn *Connection) IsConnected() bool
IsConnected returns true if the connection is not closed yet.
func (*Connection) Login ¶
func (ctn *Connection) Login(policy *ClientPolicy) Error
Login will send authentication information to the server. This function is provided for using the connection in conjunction with external libraries. The password will be hashed every time, which is a slow operation.
func (*Connection) Read ¶
func (ctn *Connection) Read(buf []byte, length int) (total int, aerr Error)
Read reads from connection buffer to the provided slice.
func (*Connection) RequestInfo ¶
func (ctn *Connection) RequestInfo(names ...string) (map[string]string, Error)
RequestInfo gets info values by name from the specified connection. Timeout should already be set on the connection.
func (*Connection) SetTimeout ¶
SetTimeout sets connection timeout for both read and write operations.
type DropIndexTask ¶
type DropIndexTask struct {
// contains filtered or unexported fields
}
DropIndexTask is used to poll for long running create index completion.
func NewDropIndexTask ¶
func NewDropIndexTask(cluster *Cluster, namespace string, indexName string) *DropIndexTask
NewDropIndexTask initializes a task with fields needed to query server nodes.
func (*DropIndexTask) IsDone ¶
func (tski *DropIndexTask) IsDone() (bool, Error)
IsDone queries all nodes for task completion status.
func (*DropIndexTask) OnComplete ¶
func (tski *DropIndexTask) OnComplete() chan Error
OnComplete returns a channel that will be closed as soon as the task is finished. If an error is encountered during operation, an error will be sent on the channel.
type DynConfig ¶ added in v8.3.0
type DynConfig struct {
// contains filtered or unexported fields
}
type Error ¶
type Error interface {
error
// Matches will return true is the ResultCode of the error or
// any of the errors wrapped down the chain has any of the
// provided codes.
Matches(rcs ...types.ResultCode) bool
// IsInDoubt signifies that the write operation may have gone through on the server
// but the client is not able to confirm that due an error.
IsInDoubt() bool
// Unwrap returns the error inside
Unwrap() error
// Trace returns a stack trace of where the error originates from
Trace() string
// contains filtered or unexported methods
}
Error is the internal error interface for the Aerospike client's errors. All the public API return this error type. This interface is compatible with error interface, including errors.Is and errors.As.
func CDTContextToBase64 ¶
func CDTContextToBase64(ctxl []*CDTContext) (string, Error)
CDTContextToBase64 converts a []*CDTContext into a base64 encoded string.
func NewTxnCommitError ¶
func NewTxnCommitError(err CommitError, verifyRecords, rollRecords []*BatchRecord, cause Error) Error
func PackFloat32 ¶
PackFloat32 packs float32 value
func PackFloat64 ¶
PackFloat64 packs float64 value
type ExecuteTask ¶
type ExecuteTask struct {
// contains filtered or unexported fields
}
ExecuteTask is used to poll for long running server execute job completion.
func NewExecuteTask ¶
func NewExecuteTask(cluster *Cluster, statement *Statement, taskId uint64) *ExecuteTask
NewExecuteTask initializes task with fields needed to query server nodes.
func (*ExecuteTask) IsDone ¶
func (etsk *ExecuteTask) IsDone() (bool, Error)
IsDone queries all nodes for task completion status.
func (*ExecuteTask) OnComplete ¶
func (etsk *ExecuteTask) OnComplete() chan Error
OnComplete returns a channel which will be closed when the task is completed. If an error is encountered while performing the task, an error will be sent on the channel.
func (*ExecuteTask) TaskId ¶
func (etsk *ExecuteTask) TaskId() uint64
TaskId returns the task id that was sent to the server.
type ExpCdtFlags ¶ added in v8.6.0
type ExpCdtFlags int64
Flags for CDT expression operations.
const ( // Identifier for CDT select expression. ExpCdtSelect ExpCdtFlags = 0xfe )
type ExpReadFlags ¶
type ExpReadFlags int
ExpReadFlags is used to change mode in expression reads.
const ( // ExpReadFlagDefault is the default ExpReadFlagDefault ExpReadFlags = 0 // ExpReadFlagEvalNoFail means: // Ignore failures caused by the expression resolving to unknown or a non-bin type. ExpReadFlagEvalNoFail ExpReadFlags = 1 << 4 )
type ExpRegexFlags ¶
type ExpRegexFlags int
ExpRegexFlags is used to change the Regex Mode in Expression Filters.
const ( // ExpRegexFlagNONE uses regex defaults. ExpRegexFlagNONE ExpRegexFlags = 0 // ExpRegexFlagEXTENDED uses POSIX Extended Regular Expression syntax when interpreting regex. ExpRegexFlagEXTENDED ExpRegexFlags = 1 << 0 // ExpRegexFlagICASE does not differentiate cases. ExpRegexFlagICASE ExpRegexFlags = 1 << 1 // ExpRegexFlagNOSUB does not report position of matches. ExpRegexFlagNOSUB ExpRegexFlags = 1 << 2 // ExpRegexFlagNEWLINE does not Match-any-character operators don't match a newline. ExpRegexFlagNEWLINE ExpRegexFlags = 1 << 3 )
type ExpType ¶
type ExpType uint
ExpType defines the expression's data type.
var ( // ExpTypeNIL is NIL Expression Type ExpTypeNIL ExpType = 0 // ExpTypeBOOL is BOOLEAN Expression Type ExpTypeBOOL ExpType = 1 // ExpTypeINT is INTEGER Expression Type ExpTypeINT ExpType = 2 // ExpTypeSTRING is STRING Expression Type ExpTypeSTRING ExpType = 3 // ExpTypeLIST is LIST Expression Type ExpTypeLIST ExpType = 4 // ExpTypeMAP is MAP Expression Type ExpTypeMAP ExpType = 5 // ExpTypeBLOB is BLOB Expression Type ExpTypeBLOB ExpType = 6 // ExpTypeFLOAT is FLOAT Expression Type ExpTypeFLOAT ExpType = 7 // ExpTypeGEO is GEO String Expression Type ExpTypeGEO ExpType = 8 // ExpTypeHLL is HLL Expression Type ExpTypeHLL ExpType = 9 )
type ExpWriteFlags ¶
type ExpWriteFlags int
ExpWriteFlags is used to change mode in expression writes.
const ( // ExpWriteFlagDefault is the default. Allows create or update. ExpWriteFlagDefault ExpWriteFlags = 0 // ExpWriteFlagCreateOnly means: // If bin does not exist, a new bin will be created. // If bin exists, the operation will be denied. // If bin exists, fail with Bin Exists ExpWriteFlagCreateOnly ExpWriteFlags = 1 << 0 // ExpWriteFlagUpdateOnly means: // If bin exists, the bin will be overwritten. // If bin does not exist, the operation will be denied. // If bin does not exist, fail with Bin Not Found ExpWriteFlagUpdateOnly ExpWriteFlags = 1 << 1 // ExpWriteFlagAllowDelete means: // If expression results in nil value, then delete the bin. // Otherwise, return OP Not Applicable when NoFail is not set ExpWriteFlagAllowDelete ExpWriteFlags = 1 << 2 // ExpWriteFlagPolicyNoFail means: // Do not raise error if operation is denied. ExpWriteFlagPolicyNoFail ExpWriteFlags = 1 << 3 // ExpWriteFlagEvalNoFail means: // Ignore failures caused by the expression resolving to unknown or a non-bin type. ExpWriteFlagEvalNoFail ExpWriteFlags = 1 << 4 )
Expression write Flags
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression which can be applied to most commands, to control which records are affected by the command.
func ExpAnd ¶
func ExpAnd(exps ...*Expression) *Expression
ExpAnd creates a "and" (&&) operator that applies to a variable number of expressions.
func ExpBinExists ¶
func ExpBinExists(name string) *Expression
ExpBinExists creates a function that returns if bin of specified name exists.
func ExpBinType ¶
func ExpBinType(name string) *Expression
ExpBinType creates a function that returns bin's integer particle type. Valid values are:
NULL = 0 INTEGER = 1 FLOAT = 2 STRING = 3 BLOB = 4 DIGEST = 6 BOOL = 17 HLL = 18 MAP = 19 LIST = 20 LDT = 21 GEOJSON = 23
func ExpBitAdd ¶
func ExpBitAdd( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, value *Expression, signed bool, action BitOverflowAction, bin *Expression, ) *Expression
ExpBitAdd creates an expression that adds value to []byte bin starting at bitOffset for bitSize and returns []byte. `BitSize` must be <= 64. Signed indicates if bits should be treated as a signed number. If add overflows/underflows, `BitOverflowAction` is used.
func ExpBitAnd ¶
func ExpBitAnd( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression, ) *Expression
ExpBitAnd creates an expression that performs bitwise "and" on value and []byte bin at bitOffset for bitSize and returns []byte.
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 23 bitSize = 9 value = [0b00111100, 0b10000000] bin result = [0b00000001, 0b01000010, 0b00000010, 0b00000000, 0b00000101]
func ExpBitB64Encode ¶ added in v8.9.0
func ExpBitB64Encode(bin *Expression) *Expression
ExpBitB64Encode creates an expression that returns the base64 text of the whole []byte bin.
func ExpBitB64EncodeRange ¶ added in v8.9.0
func ExpBitB64EncodeRange( byteOffset *Expression, byteSize *Expression, invertSize bool, bin *Expression, ) *Expression
ExpBitB64EncodeRange creates an expression that returns the base64 text of []byte bin starting at byteOffset for byteSize. When invertSize is true, byteSize counts back from the end of the bitmap, so an inverted byteSize of 0 encodes through to the end.
func ExpBitCount ¶
func ExpBitCount( bitOffset *Expression, bitSize *Expression, bin *Expression, ) *Expression
ExpBitCount creates an expression that returns integer count of set bits from []byte bin starting at bitOffset for bitSize.
func ExpBitGet ¶
func ExpBitGet( bitOffset *Expression, bitSize *Expression, bin *Expression, ) *Expression
ExpBitGet creates an expression that returns bits from []byte bin starting at bitOffset for bitSize.
func ExpBitGetInt ¶
func ExpBitGetInt( bitOffset *Expression, bitSize *Expression, signed bool, bin *Expression, ) *Expression
ExpBitGetInt Create expression that returns integer from []byte bin starting at bitOffset for bitSize. Signed indicates if bits should be treated as a signed number.
func ExpBitInsert ¶
func ExpBitInsert( policy *BitPolicy, byteOffset *Expression, value *Expression, bin *Expression, ) *Expression
ExpBitInsert creates an expression that inserts value bytes into []byte bin at byteOffset and returns []byte.
func ExpBitLScan ¶
func ExpBitLScan( bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression, ) *Expression
ExpBitLScan creates an expression that returns integer bit offset of the first specified value bit in []byte bin starting at bitOffset for bitSize.
func ExpBitLShift ¶
func ExpBitLShift( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, shift *Expression, bin *Expression, ) *Expression
ExpBitLShift creates an expression that shifts left []byte bin starting at bitOffset for bitSize and returns []byte.
func ExpBitNot ¶
func ExpBitNot( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, bin *Expression, ) *Expression
ExpBitNot creates an expression that negates []byte bin starting at bitOffset for bitSize and returns []byte.
func ExpBitOr ¶
func ExpBitOr( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression, ) *Expression
ExpBitOr creates an expression that performs bitwise "or" on value and []byte bin at bitOffset for bitSize and returns []byte.
func ExpBitRScan ¶
func ExpBitRScan( bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression, ) *Expression
ExpBitRScan creates an expression that returns integer bit offset of the last specified value bit in []byte bin starting at bitOffset for bitSize.
func ExpBitRShift ¶
func ExpBitRShift( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, shift *Expression, bin *Expression, ) *Expression
ExpBitRShift creates an expression that shifts right []byte bin starting at bitOffset for bitSize and returns []byte.
func ExpBitRemove ¶
func ExpBitRemove( policy *BitPolicy, byteOffset *Expression, byteSize *Expression, bin *Expression, ) *Expression
ExpBitRemove creates an expression that removes bytes from []byte bin at byteOffset for byteSize and returns []byte.
func ExpBitResize ¶
func ExpBitResize( policy *BitPolicy, byteSize *Expression, resizeFlags BitResizeFlags, bin *Expression, ) *Expression
ExpBitResize creates an expression that resizes []byte to byteSize according to resizeFlags and returns []byte.
func ExpBitSet ¶
func ExpBitSet( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression, ) *Expression
ExpBitSet creates an expression that sets value on []byte bin at bitOffset for bitSize and returns []byte.
func ExpBitSetInt ¶
func ExpBitSetInt( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression, ) *Expression
ExpBitSetInt creates an expression that sets value to []byte bin starting at bitOffset for bitSize and returns []byte. `BitSize` must be <= 64.
func ExpBitSubtract ¶
func ExpBitSubtract( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, value *Expression, signed bool, action BitOverflowAction, bin *Expression, ) *Expression
ExpBitSubtract creates an expression that subtracts value from []byte bin starting at bitOffset for bitSize and returns []byte. `BitSize` must be <= 64. Signed indicates if bits should be treated as a signed number. If add overflows/underflows, `BitOverflowAction` is used.
func ExpBitXor ¶
func ExpBitXor( policy *BitPolicy, bitOffset *Expression, bitSize *Expression, value *Expression, bin *Expression, ) *Expression
ExpBitXor creates an expression that performs bitwise "xor" on value and []byte bin at bitOffset for bitSize and returns []byte.
func ExpBlobBin ¶
func ExpBlobBin(name string) *Expression
ExpBlobBin creates a blob bin expression.
func ExpBlobLoopVar ¶ added in v8.6.0
func ExpBlobLoopVar(part LoopVarPart) *Expression
ExpLoopVarMap creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpBoolBin ¶
func ExpBoolBin(name string) *Expression
ExpBoolBin creates a boolean bin expression.
func ExpBoolLoopVar ¶ added in v8.6.0
func ExpBoolLoopVar(part LoopVarPart) *Expression
ExpLoopVarString creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpCond ¶
func ExpCond(exps ...*Expression) *Expression
ExpCond will conditionally select an action expression from a variable number of expression pairs followed by a default action expression. Every action expression must return the same type. The only exception is Unknown() which can be mixed with other types.
Requires server version 5.6.0+.
func ExpDef ¶
func ExpDef(name string, value *Expression) *Expression
ExpDef will assign variable to an expression that can be accessed later. Requires server version 5.6.0+.
func ExpDeviceSize
deprecated
func ExpDeviceSize() *Expression
ExpDeviceSize creates a function that returns record size on disk. If server storage-engine is memory, then zero is returned.
This expression should only be used for server versions less than 7.0. Use ExpRecordSize for server version 7.0+.
Deprecated: memory_size has been deprecated since server version 8.1. User ExpRecordSize
func ExpDigestModulo ¶
func ExpDigestModulo(modulo int64) *Expression
ExpDigestModulo creates a function that returns record digest modulo as integer.
func ExpEq ¶
func ExpEq(left *Expression, right *Expression) *Expression
ExpEq creates a equal (==) expression.
func ExpExclusive ¶
func ExpExclusive(exps ...*Expression) *Expression
ExpExclusive creates an expression that returns true if only one of the expressions are true. Requires server version 5.6.0+.
func ExpFloatBin ¶
func ExpFloatBin(name string) *Expression
ExpFloatBin creates a 64 bit float bin expression.
func ExpFloatLoopVar ¶ added in v8.6.0
func ExpFloatLoopVar(part LoopVarPart) *Expression
ExpFloatLoopVar creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpFloatVal ¶
func ExpFloatVal(val float64) *Expression
ExpFloatVal creates a 64 bit float bin value
func ExpGeoCompare ¶
func ExpGeoCompare(left *Expression, right *Expression) *Expression
ExpGeoCompare creates a compare geospatial operation.
func ExpGeoJSONLoopVar ¶ added in v8.6.0
func ExpGeoJSONLoopVar(part LoopVarPart) *Expression
ExpGeoJSONLoopVar creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpGeoVal ¶
func ExpGeoVal(val string) *Expression
ExpGeoVal creates a geospatial json string value.
func ExpGreater ¶
func ExpGreater(left *Expression, right *Expression) *Expression
ExpGreater creates a greater than (>) operation.
func ExpGreaterEq ¶
func ExpGreaterEq(left *Expression, right *Expression) *Expression
ExpGreaterEq creates a greater than or equal (>=) operation.
func ExpHLLAdd ¶
func ExpHLLAdd(policy *HLLPolicy, list *Expression, bin *Expression) *Expression
ExpHLLAdd creates an expression that adds list values to a HLL set and returns HLL set. The function assumes HLL bin already exists. indexBitCount + minHashBitCount must be <= 64.
func ExpHLLAddWithIndex ¶
func ExpHLLAddWithIndex( policy *HLLPolicy, list *Expression, indexBitCount *Expression, bin *Expression, ) *Expression
ExpHLLAddWithIndex creates an expression that adds values to a HLL set and returns HLL set. If HLL bin does not exist, use `indexBitCount` to create HLL bin.
func ExpHLLAddWithIndexAndMinHash ¶
func ExpHLLAddWithIndexAndMinHash( policy *HLLPolicy, list *Expression, indexBitCount *Expression, minHashCount *Expression, bin *Expression, ) *Expression
ExpHLLAddWithIndexAndMinHash creates an expression that adds values to a HLL set and returns HLL set. If HLL bin does not exist, use `indexBitCount` and `minHashBitCount` to create HLL set. indexBitCount + minHashBitCount must be <= 64.
func ExpHLLDescribe ¶
func ExpHLLDescribe(bin *Expression) *Expression
ExpHLLDescribe creates an expression that returns `indexBitCount` and `minHashBitCount` used to create HLL bin in a list of longs. `list[0]` is `indexBitCount` and `list[1]` is `minHashBitCount`.
func ExpHLLGetCount ¶
func ExpHLLGetCount(bin *Expression) *Expression
ExpHLLGetCount creates an expression that returns estimated number of elements in the HLL bin.
func ExpHLLGetIntersectCount ¶
func ExpHLLGetIntersectCount(list *Expression, bin *Expression) *Expression
ExpHLLGetIntersectCount creates an expression that returns estimated number of elements that would be contained by the intersection of these HLL objects.
func ExpHLLGetSimilarity ¶
func ExpHLLGetSimilarity(list *Expression, bin *Expression) *Expression
ExpHLLGetSimilarity creates an expression that returns estimated similarity of these HLL objects as a 64 bit float.
func ExpHLLGetUnion ¶
func ExpHLLGetUnion(list *Expression, bin *Expression) *Expression
ExpHLLGetUnion creates an expression that returns a HLL object that is the union of all specified HLL objects in the list with the HLL bin.
func ExpHLLGetUnionCount ¶
func ExpHLLGetUnionCount(list *Expression, bin *Expression) *Expression
ExpHLLGetUnionCount creates an expression that returns estimated number of elements that would be contained by the union of these HLL objects.
func ExpHLLInit ¶
func ExpHLLInit( policy *HLLPolicy, indexBitCount *Expression, bin *Expression, ) *Expression
ExpHLLInit creates expression that creates a new HLL or resets an existing HLL.
func ExpHLLInitWithMinHash ¶
func ExpHLLInitWithMinHash( policy *HLLPolicy, indexBitCount *Expression, minHashCount *Expression, bin *Expression, ) *Expression
ExpHLLInitWithMinHash creates expression that creates a new HLL or resets an existing HLL with minhash bits. indexBitCount + minHashBitCount must be <= 64.
func ExpHLLLoopVar ¶ added in v8.7.0
func ExpHLLLoopVar(part LoopVarPart) *Expression
ExpHLLLoopVar creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpHLLMayContain ¶
func ExpHLLMayContain(list *Expression, bin *Expression) *Expression
ExpHLLMayContain creates an expression that returns one if HLL bin may contain all items in the list.
func ExpInList ¶ added in v8.7.0
func ExpInList(value *Expression, list *Expression) *Expression
ExpInList creates an expression that checks if a value is contained in a list.
func ExpInfinityValue ¶
func ExpInfinityValue() *Expression
ExpInfinityValue creates an Infinity Value
func ExpIntARShift ¶
func ExpIntARShift(value *Expression, shift *Expression) *Expression
ExpIntARShift creates integer "arithmetic right shift" (>>) operator. The sign bit is preserved and not shifted. Requires server version 5.6.0+.
func ExpIntAnd ¶
func ExpIntAnd(exps ...*Expression) *Expression
ExpIntAnd creates integer "and" (&) operator that is applied to two or more integers. All arguments must resolve to integers. Requires server version 5.6.0+.
func ExpIntBin ¶
func ExpIntBin(name string) *Expression
ExpIntBin creates a 64 bit int bin expression.
func ExpIntCount ¶
func ExpIntCount(exp *Expression) *Expression
ExpIntCount creates expression that returns count of integer bits that are set to 1. Requires server version 5.6.0+.
func ExpIntLScan ¶
func ExpIntLScan(value *Expression, search *Expression) *Expression
ExpIntLScan creates expression that scans integer bits from left (most significant bit) to right (least significant bit), looking for a search bit value. When the search value is found, the index of that bit (where the most significant bit is index 0) is returned. If "search" is true, the scan will search for the bit value 1. If "search" is false it will search for bit value 0. Requires server version 5.6.0+.
func ExpIntLShift ¶
func ExpIntLShift(value *Expression, shift *Expression) *Expression
ExpIntLShift creates integer "left shift" (<<) operator. Requires server version 5.6.0+.
func ExpIntLoopVar ¶ added in v8.6.0
func ExpIntLoopVar(part LoopVarPart) *Expression
ExpIntLoopVar creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpIntNot ¶
func ExpIntNot(exp *Expression) *Expression
ExpIntNot creates integer "not" (~) operator. Requires server version 5.6.0+.
func ExpIntOr ¶
func ExpIntOr(exps ...*Expression) *Expression
ExpIntOr creates integer "or" (|) operator that is applied to two or more integers. All arguments must resolve to integers. Requires server version 5.6.0+.
func ExpIntRScan ¶
func ExpIntRScan(value *Expression, search *Expression) *Expression
ExpIntRScan creates expression that scans integer bits from right (least significant bit) to left (most significant bit), looking for a search bit value. When the search value is found, the index of that bit (where the most significant bit is index 0) is returned. If "search" is true, the scan will search for the bit value 1. If "search" is false it will search for bit value 0. Requires server version 5.6.0+.
func ExpIntRShift ¶
func ExpIntRShift(value *Expression, shift *Expression) *Expression
ExpIntRShift creates integer "logical right shift" (>>>) operator. Requires server version 5.6.0+.
func ExpIntXor ¶
func ExpIntXor(exps ...*Expression) *Expression
ExpIntXor creates integer "xor" (^) operator that is applied to two or more integers. All arguments must resolve to integers. Requires server version 5.6.0+.
func ExpIsTombstone ¶
func ExpIsTombstone() *Expression
ExpIsTombstone creates a expression that returns if record has been deleted and is still in tombstone state. This expression usually evaluates quickly because record meta data is cached in memory.
func ExpKey ¶
func ExpKey(expType ExpType) *Expression
ExpKey creates a record key expression of specified type.
func ExpKeyExists ¶
func ExpKeyExists() *Expression
ExpKeyExists creates a function that returns if the primary key is stored in the record meta data as a boolean expression. This would occur when `send_key` is true on record write.
func ExpLastUpdate ¶
func ExpLastUpdate() *Expression
ExpLastUpdate creates a function that returns record last update time expressed as 64 bit integer nanoseconds since 1970-01-01 epoch.
func ExpLess ¶
func ExpLess(left *Expression, right *Expression) *Expression
ExpLess creates a less than (<) operation.
func ExpLessEq ¶
func ExpLessEq(left *Expression, right *Expression) *Expression
ExpLessEq creates a less than or equals (<=) operation.
func ExpLet ¶
func ExpLet(exps ...*Expression) *Expression
ExpLet will define variables and expressions in scope. Requires server version 5.6.0+.
func ExpListAppend ¶
func ExpListAppend( policy *ListPolicy, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListAppend creates an expression that appends value to end of list.
func ExpListAppendItems ¶
func ExpListAppendItems( policy *ListPolicy, list *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListAppendItems creates an expression that appends list items to end of list.
func ExpListBin ¶
func ExpListBin(name string) *Expression
ExpListBin creates a list bin expression.
func ExpListClear ¶
func ExpListClear(bin *Expression, ctx ...*CDTContext) *Expression
ExpListClear creates an expression that removes all items in list.
func ExpListGetByIndex ¶
func ExpListGetByIndex( returnType ListReturnType, valueType ExpType, index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByIndex creates an expression that selects list item identified by index and returns selected data specified by returnType.
func ExpListGetByIndexRange ¶
func ExpListGetByIndexRange( returnType ListReturnType, index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByIndexRange creates an expression that selects list items starting at specified index to the end of list and returns selected data specified by returnType .
func ExpListGetByIndexRangeCount ¶
func ExpListGetByIndexRangeCount( returnType ListReturnType, index *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByIndexRangeCount creates an expression that selects "count" list items starting at specified index and returns selected data specified by returnType.
func ExpListGetByRank ¶
func ExpListGetByRank( returnType ListReturnType, valueType ExpType, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByRank creates an expression that selects list item identified by rank and returns selected data specified by returnType.
func ExpListGetByRankRange ¶
func ExpListGetByRankRange( returnType ListReturnType, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByRankRange creates an expression that selects list items starting at specified rank to the last ranked item and returns selected data specified by returnType.
func ExpListGetByRankRangeCount ¶
func ExpListGetByRankRangeCount( returnType ListReturnType, rank *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByRankRangeCount creates an expression that selects "count" list items starting at specified rank and returns selected data specified by returnType.
func ExpListGetByValue ¶
func ExpListGetByValue( returnType ListReturnType, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByValue creates an expression that selects list items identified by value and returns selected data specified by returnType.
func ExpListGetByValueList ¶
func ExpListGetByValueList( returnType ListReturnType, values *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByValueList creates an expression that selects list items identified by values and returns selected data specified by returnType.
func ExpListGetByValueRange ¶
func ExpListGetByValueRange( returnType ListReturnType, valueBegin *Expression, valueEnd *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByValueRange creates an expression that selects list items identified by value range and returns selected data specified by returnType.
func ExpListGetByValueRelativeRankRange ¶
func ExpListGetByValueRelativeRankRange( returnType ListReturnType, value *Expression, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByValueRelativeRankRange creates an expression that selects list items nearest to value and greater by relative rank and returns selected data specified by returnType.
Examples for ordered list \[0, 4, 5, 9, 11, 15\]:
(value,rank) = [selected items] (5,0) = [5,9,11,15] (5,1) = [9,11,15] (5,-1) = [4,5,9,11,15] (3,0) = [4,5,9,11,15] (3,3) = [11,15] (3,-3) = [0,4,5,9,11,15]
func ExpListGetByValueRelativeRankRangeCount ¶
func ExpListGetByValueRelativeRankRangeCount( returnType ListReturnType, value *Expression, rank *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListGetByValueRelativeRankRangeCount creates an expression that selects list items nearest to value and greater by relative rank with a count limit and returns selected data specified by returnType.
Examples for ordered list \[0, 4, 5, 9, 11, 15\]:
(value,rank,count) = [selected items] (5,0,2) = [5,9] (5,1,1) = [9] (5,-1,2) = [4,5] (3,0,1) = [4] (3,3,7) = [11,15] (3,-3,2) = []
func ExpListIncrement ¶
func ExpListIncrement( policy *ListPolicy, index *Expression, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListIncrement creates an expression that increments `list[index]` by value. Value expression should resolve to a number.
func ExpListInsert ¶
func ExpListInsert( policy *ListPolicy, index *Expression, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListInsert creates an expression that inserts value to specified index of list.
func ExpListInsertItems ¶
func ExpListInsertItems( policy *ListPolicy, index *Expression, list *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListInsertItems creates an expression that inserts each input list item starting at specified index of list.
func ExpListJoin ¶ added in v8.9.0
func ExpListJoin(bin *Expression, ctx ...*CDTContext) *Expression
ExpListJoin creates an expression that concatenates the string items of `bin`.
func ExpListJoinBySeparator ¶ added in v8.9.0
func ExpListJoinBySeparator(separator *Expression, bin *Expression, ctx ...*CDTContext) *Expression
ExpListJoinBySeparator creates an expression that concatenates the string items of `bin`, inserting `separator` between consecutive items. It is the inverse of ExpStringSplitBySeparator.
func ExpListLoopVar ¶ added in v8.6.0
func ExpListLoopVar(part LoopVarPart) *Expression
ExpListLoopVar creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpListRemoveByIndex ¶
func ExpListRemoveByIndex( index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByIndex creates an expression that removes list item identified by index.
func ExpListRemoveByIndexRange ¶
func ExpListRemoveByIndexRange( returnType ListReturnType, index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByIndexRange creates an expression that removes list items starting at specified index to the end of list. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
func ExpListRemoveByIndexRangeCount ¶
func ExpListRemoveByIndexRangeCount( returnType ListReturnType, index *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByIndexRangeCount creates an expression that removes "count" list items starting at specified index. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
func ExpListRemoveByRank ¶
func ExpListRemoveByRank( rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByRank creates an expression that removes list item identified by rank.
func ExpListRemoveByRankRange ¶
func ExpListRemoveByRankRange( returnType ListReturnType, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByRankRange creates an expression that removes list items starting at specified rank to the last ranked item. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
func ExpListRemoveByRankRangeCount ¶
func ExpListRemoveByRankRangeCount( returnType ListReturnType, rank *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByRankRangeCount creates an expression that removes "count" list items starting at specified rank. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
func ExpListRemoveByValue ¶
func ExpListRemoveByValue( returnType ListReturnType, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByValue creates an expression that removes list items identified by value. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
func ExpListRemoveByValueList ¶
func ExpListRemoveByValueList( returnType ListReturnType, values *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByValueList creates an expression that removes list items identified by values. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
func ExpListRemoveByValueRange ¶
func ExpListRemoveByValueRange( returnType ListReturnType, valueBegin *Expression, valueEnd *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByValueRange creates an expression that removes list items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
func ExpListRemoveByValueRelativeRankRange ¶
func ExpListRemoveByValueRelativeRankRange( returnType ListReturnType, value *Expression, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByValueRelativeRankRange creates an expression that removes list items nearest to value and greater by relative rank. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
Examples for ordered list \[0, 4, 5, 9, 11, 15\]:
(value,rank) = [removed items] (5,0) = [5,9,11,15] (5,1) = [9,11,15] (5,-1) = [4,5,9,11,15] (3,0) = [4,5,9,11,15] (3,3) = [11,15] (3,-3) = [0,4,5,9,11,15]
func ExpListRemoveByValueRelativeRankRangeCount ¶
func ExpListRemoveByValueRelativeRankRangeCount( returnType ListReturnType, value *Expression, rank *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListRemoveByValueRelativeRankRangeCount creates an expression that removes list items nearest to value and greater by relative rank with a count limit. Valid returnType values are ListReturnTypeNone or ListReturnTypeInverted.
Examples for ordered list \[0, 4, 5, 9, 11, 15\]:
(value,rank,count) = [removed items] (5,0,2) = [5,9] (5,1,1) = [9] (5,-1,2) = [4,5] (3,0,1) = [4] (3,3,7) = [11,15] (3,-3,2) = []
func ExpListSet ¶
func ExpListSet( policy *ListPolicy, index *Expression, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListSet creates an expression that sets item value at specified index in list.
func ExpListSize ¶
func ExpListSize(bin *Expression, ctx ...*CDTContext) *Expression
ExpListSize creates an expression that returns list size.
func ExpListSort ¶
func ExpListSort( sortFlags ListSortFlags, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpListSort creates an expression that sorts list according to sortFlags.
func ExpListValueVal ¶
func ExpListValueVal(val ...any) *Expression
ExpListValueVal creates a List bin Value
func ExpMapClear ¶
func ExpMapClear(bin *Expression, ctx ...*CDTContext) *Expression
ExpMapClear creates an expression that removes all items in map.
func ExpMapGetByIndex ¶
func ExpMapGetByIndex( returnType MapReturnTypes, valueType ExpType, index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByIndex creates an expression that selects map item identified by index and returns selected data specified by returnType.
func ExpMapGetByIndexRange ¶
func ExpMapGetByIndexRange( returnType MapReturnTypes, index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByIndexRange creates an expression that selects map items starting at specified index to the end of map and returns selected data specified by returnType.
func ExpMapGetByIndexRangeCount ¶
func ExpMapGetByIndexRangeCount( returnType MapReturnTypes, index *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByIndexRangeCount creates an expression that selects "count" map items starting at specified index and returns selected data specified by returnType.
func ExpMapGetByKey ¶
func ExpMapGetByKey( returnType MapReturnTypes, valueType ExpType, key *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByKey creates an expression that selects map item identified by key and returns selected data specified by returnType.
func ExpMapGetByKeyList ¶
func ExpMapGetByKeyList( returnType MapReturnTypes, keys *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByKeyList creates an expression that selects map items identified by keys and returns selected data specified by returnType
func ExpMapGetByKeyRange ¶
func ExpMapGetByKeyRange( returnType MapReturnTypes, keyBegin *Expression, keyEnd *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByKeyRange creates an expression that selects map items identified by key range (keyBegin inclusive, keyEnd exclusive). If keyBegin is nil, the range is less than keyEnd. If keyEnd is nil, the range is greater than equal to keyBegin. Expression returns selected data specified by returnType.
func ExpMapGetByKeyRelativeIndexRange ¶
func ExpMapGetByKeyRelativeIndexRange( returnType MapReturnTypes, key *Expression, index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByKeyRelativeIndexRange creates an expression that selects map items nearest to key and greater by index. Expression returns selected data specified by returnType.
Examples for ordered map [{0=17},{4=2},{5=15},{9=10}]:
* (value,index) = [selected items] * (5,0) = [{5=15},{9=10}] * (5,1) = [{9=10}] * (5,-1) = [{4=2},{5=15},{9=10}] * (3,2) = [{9=10}] * (3,-2) = [{0=17},{4=2},{5=15},{9=10}]
func ExpMapGetByKeyRelativeIndexRangeCount ¶
func ExpMapGetByKeyRelativeIndexRangeCount( returnType MapReturnTypes, key *Expression, index *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByKeyRelativeIndexRangeCount creates an expression that selects map items nearest to key and greater by index with a count limit. Expression returns selected data specified by returnType.
Examples for ordered map [{0=17},{4=2},{5=15},{9=10}]:
* (value,index,count) = [selected items] * (5,0,1) = [{5=15}] * (5,1,2) = [{9=10}] * (5,-1,1) = [{4=2}] * (3,2,1) = [{9=10}] * (3,-2,2) = [{0=17}]
func ExpMapGetByRank ¶
func ExpMapGetByRank( returnType MapReturnTypes, valueType ExpType, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByRank creates an expression that selects map item identified by rank and returns selected data specified by returnType.
func ExpMapGetByRankRange ¶
func ExpMapGetByRankRange( returnType MapReturnTypes, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByRankRange creates an expression that selects map items starting at specified rank to the last ranked item and returns selected data specified by returnType.
func ExpMapGetByRankRangeCount ¶
func ExpMapGetByRankRangeCount( returnType MapReturnTypes, rank *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByRankRangeCount creates an expression that selects "count" map items starting at specified rank and returns selected data specified by returnType.
func ExpMapGetByValue ¶
func ExpMapGetByValue( returnType MapReturnTypes, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByValue creates an expression that selects map items identified by value and returns selected data specified by returnType.
func ExpMapGetByValueList ¶
func ExpMapGetByValueList( returnType MapReturnTypes, values *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByValueList creates an expression that selects map items identified by values and returns selected data specified by returnType.
func ExpMapGetByValueRange ¶
func ExpMapGetByValueRange( returnType MapReturnTypes, valueBegin *Expression, valueEnd *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByValueRange creates an expression that selects map items identified by value range (valueBegin inclusive, valueEnd exclusive) If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin.
Expression returns selected data specified by returnType.
func ExpMapGetByValueRelativeRankRange ¶
func ExpMapGetByValueRelativeRankRange( returnType MapReturnTypes, value *Expression, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByValueRelativeRankRange creates an expression that selects map items nearest to value and greater by relative rank. Expression returns selected data specified by returnType.
Examples for map [{4=2},{9=10},{5=15},{0=17}]:
* (value,rank) = [selected items] * (11,1) = [{0=17}] * (11,-1) = [{9=10},{5=15},{0=17}]
func ExpMapGetByValueRelativeRankRangeCount ¶
func ExpMapGetByValueRelativeRankRangeCount( returnType MapReturnTypes, value *Expression, rank *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapGetByValueRelativeRankRangeCount creates an expression that selects map items nearest to value and greater by relative rank with a count limit. Expression returns selected data specified by returnType.
Examples for map [{4=2},{9=10},{5=15},{0=17}]:
* (value,rank,count) = [selected items] * (11,1,1) = [{0=17}] * (11,-1,1) = [{9=10}]
func ExpMapIncrement ¶
func ExpMapIncrement( policy *MapPolicy, key *Expression, incr *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapIncrement creates an expression that increments values by incr for all items identified by key. Valid only for numbers.
func ExpMapKeys ¶ added in v8.7.0
func ExpMapKeys(mapExp *Expression) *Expression
ExpMapKeys creates an expression that extracts all keys from a map as a list.
func ExpMapLoopVar ¶ added in v8.6.0
func ExpMapLoopVar(part LoopVarPart) *Expression
ExpMapLoopVar creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpMapPut ¶
func ExpMapPut( policy *MapPolicy, key *Expression, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapPut creates an expression that writes key/value item to map bin.
func ExpMapPutItems ¶
func ExpMapPutItems( policy *MapPolicy, amap *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapPutItems creates an expression that writes each map item to map bin.
func ExpMapRemoveByIndex ¶
func ExpMapRemoveByIndex( index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByIndex creates an expression that removes map item identified by index.
func ExpMapRemoveByIndexRange ¶
func ExpMapRemoveByIndexRange( returnType MapReturnTypes, index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByIndexRange creates an expression that removes map items starting at specified index to the end of map. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByIndexRangeCount ¶
func ExpMapRemoveByIndexRangeCount( returnType MapReturnTypes, index *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByIndexRangeCount creates an expression that removes "count" map items starting at specified index. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByKey ¶
func ExpMapRemoveByKey( key *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByKey creates an expression that removes map item identified by key.
func ExpMapRemoveByKeyList ¶
func ExpMapRemoveByKeyList( returnType MapReturnTypes, keys *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByKeyList creates an expression that removes map items identified by keys. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByKeyRange ¶
func ExpMapRemoveByKeyRange( returnType MapReturnTypes, keyBegin *Expression, keyEnd *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByKeyRange creates an expression that removes map items identified by key range (keyBegin inclusive, keyEnd exclusive). If keyBegin is nil, the range is less than keyEnd. If keyEnd is nil, the range is greater than equal to keyBegin. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByKeyRelativeIndexRange ¶
func ExpMapRemoveByKeyRelativeIndexRange( returnType MapReturnTypes, key *Expression, index *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByKeyRelativeIndexRange creates an expression that removes map items nearest to key and greater by index. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
Examples for map [{0=17},{4=2},{5=15},{9=10}]:
* (value,index) = [removed items] * (5,0) = [{5=15},{9=10}] * (5,1) = [{9=10}] * (5,-1) = [{4=2},{5=15},{9=10}] * (3,2) = [{9=10}] * (3,-2) = [{0=17},{4=2},{5=15},{9=10}]
func ExpMapRemoveByKeyRelativeIndexRangeCount ¶
func ExpMapRemoveByKeyRelativeIndexRangeCount( returnType MapReturnTypes, key *Expression, index *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByKeyRelativeIndexRangeCount creates an expression that removes map items nearest to key and greater by index with a count limit. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
Examples for map [{0=17},{4=2},{5=15},{9=10}]:
(value,index,count) = [removed items] * (5,0,1) = [{5=15}] * (5,1,2) = [{9=10}] * (5,-1,1) = [{4=2}] * (3,2,1) = [{9=10}] * (3,-2,2) = [{0=17}]
func ExpMapRemoveByRank ¶
func ExpMapRemoveByRank( rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByRank creates an expression that removes map item identified by rank.
func ExpMapRemoveByRankRange ¶
func ExpMapRemoveByRankRange( returnType MapReturnTypes, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByRankRange creates an expression that removes map items starting at specified rank to the last ranked item. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByRankRangeCount ¶
func ExpMapRemoveByRankRangeCount( returnType MapReturnTypes, rank *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByRankRangeCount creates an expression that removes "count" map items starting at specified rank. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByValue ¶
func ExpMapRemoveByValue( returnType MapReturnTypes, value *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByValue creates an expression that removes map items identified by value. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByValueList ¶
func ExpMapRemoveByValueList( returnType MapReturnTypes, values *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByValueList creates an expression that removes map items identified by values. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByValueRange ¶
func ExpMapRemoveByValueRange( returnType MapReturnTypes, valueBegin *Expression, valueEnd *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByValueRange creates an expression that removes map items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
func ExpMapRemoveByValueRelativeRankRange ¶
func ExpMapRemoveByValueRelativeRankRange( returnType MapReturnTypes, value *Expression, rank *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByValueRelativeRankRange creates an expression that removes map items nearest to value and greater by relative rank. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
Examples for map [{4=2},{9=10},{5=15},{0=17}]:
* (value,rank) = [removed items] * (11,1) = [{0=17}] * (11,-1) = [{9=10},{5=15},{0=17}]
func ExpMapRemoveByValueRelativeRankRangeCount ¶
func ExpMapRemoveByValueRelativeRankRangeCount( returnType MapReturnTypes, value *Expression, rank *Expression, count *Expression, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpMapRemoveByValueRelativeRankRangeCount creates an expression that removes map items nearest to value and greater by relative rank with a count limit. Valid returnType values are MapReturnType.NONE or MapReturnType.INVERTED.
Examples for map [{4=2},{9=10},{5=15},{0=17}]:
* (value,rank,count) = [removed items] * (11,1,1) = [{0=17}] * (11,-1,1) = [{9=10}]
func ExpMapSize ¶
func ExpMapSize(bin *Expression, ctx ...*CDTContext) *Expression
ExpMapSize creates an expression that returns list size.
func ExpMapValues ¶ added in v8.7.0
func ExpMapValues(mapExp *Expression) *Expression
ExpMapValues creates an expression that extracts all values from a map as a list.
func ExpMax ¶
func ExpMax(exps ...*Expression) *Expression
ExpMax creates expression that returns the maximum value in a variable number of expressions. All arguments must be the same type (integer or float). Requires server version 5.6.0+.
func ExpMemorySize
deprecated
func ExpMemorySize() *Expression
ExpMemorySize creates expression that returns record size in memory. If server storage-engine is not memory nor data-in-memory, then zero is returned. This expression usually evaluates quickly because record meta data is cached in memory.
Requires server version between 5.3 inclusive and 7.0 exclusive. Use ExpRecordSize for server version 7.0+.
Deprecated: memory_size has been deprecated since server version 8.1. User ExpRecordSize
func ExpMin ¶
func ExpMin(exps ...*Expression) *Expression
ExpMin creates expression that returns the minimum value in a variable number of expressions. All arguments must be the same type (integer or float). Requires server version 5.6.0+.
func ExpModifyByPath ¶ added in v8.6.0
func ExpModifyByPath( returnType ExpType, flag ModifyFlag, bin *Expression, modifyExp *Expression, ctx ...*CDTContext, ) *Expression
ExpModifyByPathOrdered creates a modify by path expression using the new order format. This is the new version that packs arguments in a different order for compatibility.
func ExpNilLoopVar ¶ added in v8.6.0
func ExpNilLoopVar(part LoopVarPart) *Expression
ExpNilLoopVar creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpNotEq ¶
func ExpNotEq(left *Expression, right *Expression) *Expression
ExpNotEq creates a not equal (!=) expression
func ExpNumAbs ¶
func ExpNumAbs(value *Expression) *Expression
ExpNumAbs creates operator that returns absolute value of a number. All arguments must resolve to integer or float. Requires server version 5.6.0+.
func ExpNumAdd ¶
func ExpNumAdd(exps ...*Expression) *Expression
ExpNumAdd creates "add" (+) operator that applies to a variable number of expressions. Return sum of all `FilterExpressions` given. All arguments must resolve to the same type (integer or float). Requires server version 5.6.0+.
func ExpNumCeil ¶
func ExpNumCeil(num *Expression) *Expression
ExpNumCeil creates expression that rounds a floating point number up to the closest integer value. The return type is float. Requires server version 5.6.0+.
func ExpNumDiv ¶
func ExpNumDiv(exps ...*Expression) *Expression
ExpNumDiv creates "divide" (/) operator that applies to a variable number of expressions. If there is only one `FilterExpressions`, returns the reciprocal for that `FilterExpressions`. Otherwise, return the first `FilterExpressions` divided by the product of the rest. All `FilterExpressions` must resolve to the same type (integer or float). Requires server version 5.6.0+.
func ExpNumFloor ¶
func ExpNumFloor(num *Expression) *Expression
ExpNumFloor creates expression that rounds a floating point number down to the closest integer value. The return type is float. Requires server version 5.6.0+.
func ExpNumLog ¶
func ExpNumLog(num *Expression, base *Expression) *Expression
ExpNumLog creates "log" operator for logarithm of "num" with base "base". All arguments must resolve to floats. Requires server version 5.6.0+.
func ExpNumMod ¶
func ExpNumMod(numerator *Expression, denominator *Expression) *Expression
ExpNumMod creates "modulo" (%) operator that determines the remainder of "numerator" divided by "denominator". All arguments must resolve to integers. Requires server version 5.6.0+.
func ExpNumMul ¶
func ExpNumMul(exps ...*Expression) *Expression
ExpNumMul creates "multiply" (*) operator that applies to a variable number of expressions. Return the product of all `FilterExpressions`. If only one `FilterExpressions` is supplied, return that `FilterExpressions`. All `FilterExpressions` must resolve to the same type (integer or float). Requires server version 5.6.0+.
func ExpNumPow ¶
func ExpNumPow(base *Expression, exponent *Expression) *Expression
ExpNumPow creates "power" operator that raises a "base" to the "exponent" power. All arguments must resolve to floats. Requires server version 5.6.0+.
func ExpNumSub ¶
func ExpNumSub(exps ...*Expression) *Expression
ExpNumSub creates "subtract" (-) operator that applies to a variable number of expressions. If only one `FilterExpressions` is provided, return the negation of that argument. Otherwise, return the sum of the 2nd to Nth `FilterExpressions` subtracted from the 1st `FilterExpressions`. All `FilterExpressions` must resolve to the same type (integer or float). Requires server version 5.6.0+.
func ExpOr ¶
func ExpOr(exps ...*Expression) *Expression
ExpOr creates a "or" (||) operator that applies to a variable number of expressions.
func ExpRecordSize ¶
func ExpRecordSize() *Expression
ExpRecordSize creates an expression that returns the record size. This expression usually evaluates quickly because record meta data is cached in memory.
Requires server version 7.0+. This expression replaces ExpDeviceSize and ExpMemorySize since those older expressions are equivalent on server version 7.0+.
func ExpRegexCompare
deprecated
func ExpRegexCompare(regex string, flags ExpRegexFlags, bin *Expression) *Expression
ExpRegexCompare creates a function like regular expression string operation.
Deprecated: ExpRegexCompare has been deprecated since 8.8.0. Use ExpStringRegexCompare or ExpStringRegexCompareWithFlags instead. This legacy comparison uses POSIX regex and is not Unicode/DBCS-aware; the string-package equivalent uses ICU regex and provides consistent Unicode handling across the string ops.
func ExpRemoveResult ¶ added in v8.6.0
func ExpRemoveResult() *Expression
ExpRemoveResult creates a result remove expression. Requires server version 8.1.1+.
func ExpSelectByPath ¶ added in v8.6.0
func ExpSelectByPath( returnType ExpType, flag SelectFlag, bin *Expression, ctx ...*CDTContext, ) *Expression
ExpSelectByPathOrdered creates a select by path expression using the new order format. This is the new version that packs arguments in a different order for compatibility.
func ExpSetName ¶
func ExpSetName() *Expression
ExpSetName creates a function that returns record set name string.
func ExpSinceUpdate ¶
func ExpSinceUpdate() *Expression
ExpSinceUpdate creates a expression that returns milliseconds since the record was last updated. This expression usually evaluates quickly because record meta data is cached in memory.
func ExpStringAppend ¶ added in v8.9.0
func ExpStringAppend(policy *StringPolicy, src *Expression, value *Expression) *Expression
ExpStringAppend creates an expression that appends `value` to the end of `src` and returns the resulting string. Unicode/DBCS-aware counterpart to the legacy byte-level append; does not modify the underlying bin.
func ExpStringB64Decode ¶ added in v8.9.0
func ExpStringB64Decode(src *Expression) *Expression
ExpStringB64Decode creates an expression that base64-decodes `src` and returns the decoded bytes as a blob. A source that is not valid base64 fails with types.OP_NOT_APPLICABLE, subcode types.SubCodeOpNotStringB64Invalid.
func ExpStringBin ¶
func ExpStringBin(name string) *Expression
ExpStringBin creates a string bin expression.
func ExpStringByteLength ¶ added in v8.9.0
func ExpStringByteLength(src *Expression) *Expression
ExpStringByteLength creates an expression that returns the UTF-8 byte length of `src` as an int64. Differs from ExpStringLen for non-ASCII content where one codepoint can encode to multiple bytes.
func ExpStringCaseFold ¶ added in v8.9.0
func ExpStringCaseFold(policy *StringPolicy, src *Expression) *Expression
ExpStringCaseFold creates an expression that returns `src` case-folded (locale-independent lowercase). Useful for normalized comparison keys. Does not modify the underlying bin.
func ExpStringCharAt ¶ added in v8.9.0
func ExpStringCharAt(src *Expression, index *Expression) *Expression
ExpStringCharAt creates an expression that returns the codepoint at `index` of `src` as a one-codepoint string. Negative indexes count from the end.
func ExpStringConcat ¶ added in v8.9.0
func ExpStringConcat(policy *StringPolicy, src *Expression, values *Expression) *Expression
ExpStringConcat creates an expression that concatenates `values` (a list of strings) onto `src` in order, returning the resulting string. Does not modify the underlying bin.
func ExpStringContains ¶ added in v8.9.0
func ExpStringContains(src *Expression, needle *Expression) *Expression
ExpStringContains creates an expression that tests whether `src` contains `needle` as a substring. Returns a boolean.
func ExpStringEndsWith ¶ added in v8.9.0
func ExpStringEndsWith(src *Expression, suffix *Expression) *Expression
ExpStringEndsWith creates an expression that tests whether `src` ends with `suffix`. Returns a boolean. Matching is Unicode canonical, not byte-exact: a suffix in a different normalization form than the source still matches.
func ExpStringFind ¶ added in v8.9.0
func ExpStringFind(src *Expression, needle *Expression) *Expression
ExpStringFind creates an expression that returns the codepoint index of the first occurrence of `needle` in `src`, or -1 if not found.
func ExpStringFindNth ¶ added in v8.9.0
func ExpStringFindNth(src *Expression, needle *Expression, occurrence *Expression) *Expression
ExpStringFindNth creates an expression that returns the codepoint index of the `occurrence`-th match of `needle` (1 = first, -1 = last), or -1 if not found.
func ExpStringInsert ¶ added in v8.9.0
func ExpStringInsert(policy *StringPolicy, src *Expression, index *Expression, value *Expression) *Expression
ExpStringInsert creates an expression that splices `value` into `src` at codepoint `index` and returns the resulting string. Negative indexes count from the end. Does not modify the underlying bin.
func ExpStringIsLower ¶ added in v8.9.0
func ExpStringIsLower(src *Expression) *Expression
ExpStringIsLower creates an expression that tests whether every cased codepoint in `src` is lowercase. Returns a boolean.
func ExpStringIsNumeric ¶ added in v8.9.0
func ExpStringIsNumeric(src *Expression) *Expression
ExpStringIsNumeric creates an expression that tests whether `src` contains a valid integer or float literal. Returns a boolean.
func ExpStringIsNumericTyped ¶ added in v8.9.0
func ExpStringIsNumericTyped(src *Expression, numericType StringNumericType) *Expression
ExpStringIsNumericTyped creates an expression that tests whether `src` parses as a number of the requested StringNumericType. Returns a boolean.
func ExpStringIsUpper ¶ added in v8.9.0
func ExpStringIsUpper(src *Expression) *Expression
ExpStringIsUpper creates an expression that tests whether every cased codepoint in `src` is uppercase. Returns a boolean.
func ExpStringLen ¶ added in v8.9.0
func ExpStringLen(src *Expression) *Expression
ExpStringLen creates an expression that returns the number of Unicode codepoints in `src` as an int64. The returned value is the codepoint count, not the count of user-perceived characters (grapheme clusters). For UTF-8 byte length, use ExpStringByteLength.
func ExpStringLoopVar ¶ added in v8.6.0
func ExpStringLoopVar(part LoopVarPart) *Expression
ExpStringLoopVar creates a loop variable expression for the specified part. This function is used in conjunction with list/map iteration expressions. Requires server version 8.1.1+.
func ExpStringLower ¶ added in v8.9.0
func ExpStringLower(policy *StringPolicy, src *Expression) *Expression
ExpStringLower creates an expression that returns `src` lowercased. Does not modify the underlying bin.
func ExpStringNormalizeNFC ¶ added in v8.9.0
func ExpStringNormalizeNFC(policy *StringPolicy, src *Expression) *Expression
ExpStringNormalizeNFC creates an expression that returns `src` normalized to Unicode NFC form. Already-normalized strings are unchanged. Does not modify the underlying bin.
func ExpStringOverwrite ¶ added in v8.9.0
func ExpStringOverwrite(policy *StringPolicy, src *Expression, index *Expression, value *Expression) *Expression
ExpStringOverwrite creates an expression that overwrites codepoints in `src` starting at codepoint `index` with `value`, returning the resulting string. Does not modify the underlying bin.
func ExpStringPadEnd ¶ added in v8.9.0
func ExpStringPadEnd(policy *StringPolicy, src *Expression, targetLength *Expression, padString *Expression) *Expression
ExpStringPadEnd creates an expression that appends `padString` to `src` repeatedly until the result reaches `targetLength` codepoints. No-op when the source is already at or above the target length. Does not modify the underlying bin.
func ExpStringPadStart ¶ added in v8.9.0
func ExpStringPadStart(policy *StringPolicy, src *Expression, targetLength *Expression, padString *Expression) *Expression
ExpStringPadStart creates an expression that prepends `padString` to `src` repeatedly until the result reaches `targetLength` codepoints. No-op when the source is already at or above the target length. Does not modify the underlying bin.
func ExpStringPrepend ¶ added in v8.9.0
func ExpStringPrepend(policy *StringPolicy, src *Expression, value *Expression) *Expression
ExpStringPrepend creates an expression that prepends `value` to the start of `src` and returns the resulting string. Unicode/DBCS-aware counterpart to the legacy byte-level prepend; does not modify the underlying bin.
func ExpStringRegexCompare ¶ added in v8.9.0
func ExpStringRegexCompare(src *Expression, pattern *Expression) *Expression
ExpStringRegexCompare creates an expression that tests whether `pattern` (ICU regex syntax) matches `src`. Returns a boolean.
func ExpStringRegexCompareWithFlags ¶ added in v8.9.0
func ExpStringRegexCompareWithFlags(src *Expression, pattern *Expression, regexFlags StringRegexFlags) *Expression
ExpStringRegexCompareWithFlags creates an expression that tests whether `pattern` matches `src` under the supplied StringRegexFlags. Flags can be combined with bitwise OR. Returns a boolean.
func ExpStringRegexReplace ¶ added in v8.9.0
func ExpStringRegexReplace(policy *StringPolicy, src *Expression, pattern *Expression, replacement *Expression, regexFlags StringRegexFlags) *Expression
ExpStringRegexReplace creates an expression that replaces matches of `pattern` (ICU regex syntax) in `src` with `replacement` and returns the resulting string. Pass StringRegexGlobal to replace every match. Flag values may be combined with bitwise OR. Does not modify the underlying bin.
The StringWriteDefault, StringWriteUpdateOnly and StringWriteNoFail write flags apply to this expression; StringWriteCreateOnly is rejected by the server. StringWriteNoFail also suppresses a regex-compile failure.
func ExpStringRepeat ¶ added in v8.9.0
func ExpStringRepeat(policy *StringPolicy, src *Expression, count *Expression) *Expression
ExpStringRepeat creates an expression that returns `src` repeated `count` times. Does not modify the underlying bin.
func ExpStringReplace ¶ added in v8.9.0
func ExpStringReplace(policy *StringPolicy, src *Expression, needle *Expression, replacement *Expression) *Expression
ExpStringReplace creates an expression that replaces the first occurrence of `needle` in `src` with `replacement` and returns the resulting string. Does not modify the underlying bin.
func ExpStringReplaceAll ¶ added in v8.9.0
func ExpStringReplaceAll(policy *StringPolicy, src *Expression, needle *Expression, replacement *Expression) *Expression
ExpStringReplaceAll creates an expression that replaces every occurrence of `needle` in `src` with `replacement` and returns the resulting string. Does not modify the underlying bin.
func ExpStringSnip ¶ added in v8.9.0
func ExpStringSnip(policy *StringPolicy, src *Expression, start *Expression, end *Expression) *Expression
ExpStringSnip creates an expression that removes the half-open codepoint range [start, end) from `src` and returns the resulting string. Does not modify the underlying bin.
func ExpStringSnipFrom ¶ added in v8.9.0
func ExpStringSnipFrom(policy *StringPolicy, src *Expression, start *Expression) *Expression
ExpStringSnipFrom creates an expression that removes codepoints from `src` starting at codepoint `start` through the end, returning the truncated string. Does not modify the underlying bin.
The server's snip argument list is positional — start, end, flags — so the one-argument form cannot carry `policy` flags without also supplying an explicit `end`. `policy` is accepted for signature parity with the rest of the modify expressions; use ExpStringSnip when the write flags matter.
func ExpStringSplit ¶ added in v8.9.0
func ExpStringSplit(src *Expression) *Expression
ExpStringSplit creates an expression that splits `src` by Unicode codepoint — each codepoint becomes its own list element.
func ExpStringSplitBySeparator ¶ added in v8.9.0
func ExpStringSplitBySeparator(src *Expression, separator *Expression) *Expression
ExpStringSplitBySeparator creates an expression that splits `src` by the `separator` substring. If the separator is absent, the result is a singleton list containing the whole source.
func ExpStringStartsWith ¶ added in v8.9.0
func ExpStringStartsWith(src *Expression, prefix *Expression) *Expression
ExpStringStartsWith creates an expression that tests whether `src` begins with `prefix`. Returns a boolean. Matching is Unicode canonical, not byte-exact: a prefix in a different normalization form than the source still matches.
func ExpStringSubstr ¶ added in v8.9.0
func ExpStringSubstr(src *Expression, start *Expression, end *Expression) *Expression
ExpStringSubstr creates an expression that returns the substring of `src` in the half-open codepoint range `[start, end)`. Negative indexes count from the end.
func ExpStringSubstrFrom ¶ added in v8.9.0
func ExpStringSubstrFrom(src *Expression, start *Expression) *Expression
ExpStringSubstrFrom creates an expression that returns the substring of `src` from codepoint `start` to the end. Negative `start` counts from the end of the string.
func ExpStringToBlob ¶ added in v8.9.0
func ExpStringToBlob(src *Expression) *Expression
ExpStringToBlob creates an expression that returns the UTF-8 bytes of `src` as a blob.
func ExpStringToDouble ¶ added in v8.9.0
func ExpStringToDouble(src *Expression) *Expression
ExpStringToDouble creates an expression that parses `src` as a 64-bit float. A source that cannot be parsed as a double fails with types.OP_NOT_APPLICABLE, subcode types.SubCodeOpNotStringConversionFailed.
func ExpStringToInteger ¶ added in v8.9.0
func ExpStringToInteger(src *Expression) *Expression
ExpStringToInteger creates an expression that parses `src` as an int64. A source that cannot be parsed as an integer fails with types.OP_NOT_APPLICABLE, subcode types.SubCodeOpNotStringConversionFailed.
func ExpStringToString ¶ added in v8.9.0
func ExpStringToString(src *Expression) *Expression
ExpStringToString creates an expression that returns the string representation of `src`, where `src` may be any expression yielding an integer, float, bool, string, or blob value. Returns AEROSPIKE_ERR_INCOMPATIBLE_TYPE for any other source type. A blob source that is not valid UTF-8 fails with types.OP_NOT_APPLICABLE, subcode types.SubCodeOpNotStringUTF8Invalid.
func ExpStringTrim ¶ added in v8.9.0
func ExpStringTrim(policy *StringPolicy, src *Expression) *Expression
ExpStringTrim creates an expression that returns `src` with whitespace removed from both ends. Does not modify the underlying bin.
func ExpStringTrimEnd ¶ added in v8.9.0
func ExpStringTrimEnd(policy *StringPolicy, src *Expression) *Expression
ExpStringTrimEnd creates an expression that returns `src` with whitespace removed from the end. Does not modify the underlying bin.
func ExpStringTrimStart ¶ added in v8.9.0
func ExpStringTrimStart(policy *StringPolicy, src *Expression) *Expression
ExpStringTrimStart creates an expression that returns `src` with whitespace removed from the start. Does not modify the underlying bin.
func ExpStringUpper ¶ added in v8.9.0
func ExpStringUpper(policy *StringPolicy, src *Expression) *Expression
ExpStringUpper creates an expression that returns `src` uppercased. Does not modify the underlying bin.
func ExpStringVal ¶
func ExpStringVal(val string) *Expression
ExpStringVal creates a String bin value
func ExpTTL ¶
func ExpTTL() *Expression
ExpTTL creates a function that returns record expiration time (time to live) in integer seconds.
func ExpToFloat ¶
func ExpToFloat(num *Expression) *Expression
ExpToFloat creates expression that converts a float to an integer. Requires server version 5.6.0+.
func ExpToInt ¶
func ExpToInt(num *Expression) *Expression
ExpToInt creates expression that converts an integer to a float. Requires server version 5.6.0+.
func ExpUnknown ¶
func ExpUnknown() *Expression
ExpUnknown creates unknown value. Used to intentionally fail an expression. The failure can be ignored with `ExpWriteFlags` `EVAL_NO_FAIL` or `ExpReadFlags` `EVAL_NO_FAIL`. Requires server version 5.6.0+.
func ExpValueArrayVal ¶
func ExpValueArrayVal(val ValueArray) *Expression
ExpValueArrayVal creates a List bin Value
func ExpVar ¶
func ExpVar(name string) *Expression
ExpVar will retrieve expression value from a variable. Requires server version 5.6.0+.
func ExpVoidTime ¶
func ExpVoidTime() *Expression
ExpVoidTime creates a function that returns record expiration time expressed as 64 bit integer nanoseconds since 1970-01-01 epoch.
func ExpWildCardValue ¶
func ExpWildCardValue() *Expression
ExpWildCardValue creates a WildCard Value
func (*Expression) Base64 ¶
func (fe *Expression) Base64() (string, Error)
type ExpressionArgument ¶
type ExpressionArgument interface {
// contains filtered or unexported methods
}
ExpressionArgument is used for passing arguments to filter expressions. The acceptable arguments are: Value, ExpressionFilter, []*CDTContext
type ExpressionTrace ¶ added in v8.9.0
type ExpressionTrace struct {
// Phase that failed: [ExpTracePhaseBuild] or [ExpTracePhaseEval]; -1 when absent.
Phase int
// ByteOffset into the msgpack expression payload of the failing element, or -1
// when absent. This is a coordinate into the wire payload the client sent - not
// into AEL source text (see AelOffset).
ByteOffset int
// Op is the failing op name (pre-rendered server-side), or "" when absent.
Op string
// Depth is the true nesting depth of the fault, or -1 when absent. Reports the
// true count even when Path was truncated to the frame cap.
Depth int
// Path is the op-name chain from root to fault, or nil when absent. May contain
// an [ExpTracePathTruncationSentinel] ("...") element mid-slice when the true
// nesting exceeded the server's path-frame cap; Depth still reports the true count.
Path []string
// Snippet is a human-only rendered snippet of the failing element, or "" when
// absent (the server drops it once Operands are gone and the budget is still tight).
Snippet string
// Outcome is why the record was not matched, on an eval-phase trace:
// [ExpTraceOutcomeFault], [ExpTraceOutcomeFalse] or [ExpTraceOutcomeAbsent];
// -1 when absent. The build phase never emits it.
Outcome int
// Operands are the decisive comparison's operand values as [lhs, rhs] - e.g.
// ["15", "18"] - or nil when absent. Emitted only for an [ExpTraceOutcomeFalse]
// trace whose decisive op is a comparison, and dropped first by the budget, so
// a FALSE outcome does not guarantee them. Server-rendered display strings
// capped at 48 bytes: numbers always fit, non-scalars render as a placeholder
// ("<blob>", "<collection>"), and only a long string bin is silently clipped.
Operands []string
// Lang is the source language: [ExpTraceLangMsgpack] or [ExpTraceLangAel]. An
// absent lang key means msgpack (the default), so this reads as ExpTraceLangMsgpack
// when the server omitted it.
Lang int
// AelOffset is the char offset into the AEL source text, or -1 when absent.
// Populated only when Lang is [ExpTraceLangAel]. A different coordinate space
// from ByteOffset.
AelOffset int
// AelSpan is the byte width of the offending AEL source region, or -1 when absent.
// Populated only when Lang is [ExpTraceLangAel].
AelSpan int
}
ExpressionTrace is a structured expression build/eval trace surfaced at error-detail verbosity 3.
When extended error detail is requested at verbosity 3 (see BasePolicy.ErrorDetailVerbosity) and the server fails to build or evaluate an expression - a metadata/predicate filter (filter_exp) or an exp_read/exp_write operation - it attaches this trace as a nested map under the field-45 error-detail key 3. It is surfaced on AerospikeError.ExpTrace.
Three flavours are emitted: a build trace (ExpTracePhaseBuild) when a filter or an exp_read/exp_write operation fails to compile; an eval-fault trace (ExpTracePhaseEval) when a compiled expression faults during evaluation; and the filter-decision explainer, which additionally populates Outcome and Operands to say why a record was rejected and which values decided it.
Expression build failures carry types.PARAMETER_ERROR and types.SubCodeNone (no subcode); the contextual message is on the error. Eval-phase traces ride the result code the eval produced (types.FILTERED_OUT, types.OP_NOT_APPLICABLE), not PARAMETER_ERROR. The trace is purely additive diagnostic detail - it never changes the result code, subcode, or message-string format.
Every field is optional. The server caps the whole error-detail payload and drops whole tiers in a fixed order when the budget is tight - Operands first, then Snippet, then Path - so those may be absent even within a present trace. If the structural core will not fit, no trace is sent at all, so a verbosity-3 expression failure does not guarantee one. Absent integer fields read as -1 (except Lang, which defaults to ExpTraceLangMsgpack); absent string fields read as "" and an absent Path/Operands reads as nil. Never require any field.
Two coordinate spaces - do not conflate them. ByteOffset is a byte offset into the msgpack expression payload the client sent. The AelOffset/AelSpan pair are offsets into AEL source text - a different coordinate space, populated only when Lang is ExpTraceLangAel.
func (*ExpressionTrace) String ¶ added in v8.9.0
func (t *ExpressionTrace) String() string
String implements the Stringer interface.
type FieldType ¶
type FieldType int
FieldType represents the type of the field in Aerospike Wire Protocol
const ( NAMESPACE FieldType = 0 TABLE FieldType = 1 KEY FieldType = 2 RECORD_VERSION FieldType = 3 DIGEST_RIPE FieldType = 4 MRT_ID FieldType = 5 MRT_DEADLINE FieldType = 6 QUERY_ID FieldType = 7 SOCKET_TIMEOUT FieldType = 9 RECORDS_PER_SECOND FieldType = 10 PID_ARRAY FieldType = 11 DIGEST_ARRAY FieldType = 12 MAX_RECORDS FieldType = 13 BVAL_ARRAY FieldType = 15 INDEX_NAME FieldType = 21 INDEX_RANGE FieldType = 22 INDEX_CONTEXT FieldType = 23 INDEX_EXPRESSION FieldType = 24 INDEX_TYPE FieldType = 26 UDF_PACKAGE_NAME FieldType = 30 UDF_FUNCTION FieldType = 31 UDF_ARGLIST FieldType = 32 UDF_OP FieldType = 33 QUERY_BINLIST FieldType = 40 BATCH_INDEX FieldType = 41 BATCH_INDEX_WITH_SET FieldType = 42 FILTER_EXP FieldType = 43 ERROR_MESSAGE FieldType = 45 )
FieldType constants used in the Aerospike Wire Protocol.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter specifies a query filter definition.
func NewContainsFilter ¶
func NewContainsFilter(binName string, indexCollectionType IndexCollectionType, value any, ctx ...*CDTContext) *Filter
NewContainsFilter creates a contains filter for query on collection index. Value can be an integer, string or a blob (byte array). Byte arrays are only supported on server v7+.
func NewContainsRangeFilter ¶
func NewContainsRangeFilter(binName string, indexCollectionType IndexCollectionType, begin, end int64, ctx ...*CDTContext) *Filter
NewContainsRangeFilter creates a contains filter for query on ranges of data in a collection index.
func NewContainsRangeWithExpressionFilter ¶ added in v8.3.0
func NewContainsRangeWithExpressionFilter(expression *Expression, collectionType IndexCollectionType, begin, end int64) *Filter
NewContainsRangeWithExpressionFilter creates a contains filter for query on ranges of data in a collection index with an expression.
func NewContainsRangeWithIndexNameFilter ¶ added in v8.3.0
func NewContainsRangeWithIndexNameFilter(indexName string, collectionType IndexCollectionType, begin, end int64) *Filter
NewContainsRangeWithIndexNameFilter creates a contains filter for query on ranges of data in a collection index with an index name.
func NewContainsWithExpressionFilter ¶ added in v8.3.0
func NewContainsWithExpressionFilter(expression *Expression, indexCollectionType IndexCollectionType, value any) *Filter
NewContainsWithExpressionFilter creates a contains filter for query on collection index with an expression. Value can be an integer, string or a blob (byte array). Byte arrays are only supported on server v7+.
func NewContainsWithIndexNameFilter ¶ added in v8.3.0
func NewContainsWithIndexNameFilter(indexName string, indexCollectionType IndexCollectionType, value any) *Filter
NewContainsWithIndexNameFilter creates a contains filter for query on collection index with an index name. Value can be an integer, string or a blob (byte array). Byte arrays are only supported on server v7+.
func NewEqualFilter ¶
func NewEqualFilter(binName string, value any, ctx ...*CDTContext) *Filter
NewEqualFilter creates a new equality filter instance for query. Value can be an integer, string or a blob (byte array). Byte arrays are only supported on server v7+.
func NewEqualWithExpressionFilter ¶ added in v8.3.0
func NewEqualWithExpressionFilter(expression *Expression, value any) *Filter
NewEqualWithExpressionFilter creates an equality filter for query with an expression. Value can be an integer, string or a blob (byte array). Byte arrays are only supported on server v7+.
func NewEqualWithIndexNameFilter ¶ added in v8.3.0
NewEqualWithIndexNameFilter creates an equality filter for query with an index name. Value can be an integer, string or a blob (byte array). Byte arrays are only supported on server v7+.
func NewFilter ¶
func NewFilter(name string, indexCollectionType IndexCollectionType, valueParticleType int, begin Value, end Value, ctx []*CDTContext) *Filter
Create a filter for query. Range arguments must be longs or integers which can be cast to longs. String ranges are not supported.
func NewGeoRegionsContainingPointFilter ¶
func NewGeoRegionsContainingPointFilter(binName, point string, ctx ...*CDTContext) *Filter
NewGeoRegionsContainingPointFilter creates a geospatial "containing point" filter for query. Argument must be a valid GeoJSON point.
func NewGeoRegionsContainingPointForCollectionFilter ¶
func NewGeoRegionsContainingPointForCollectionFilter(binName string, collectionType IndexCollectionType, point string, ctx ...*CDTContext) *Filter
NewGeoRegionsContainingPointForCollectionFilter creates a geospatial "containing point" filter for query on collection index. Argument must be a valid GeoJSON point.
func NewGeoRegionsContainingPointForCollectionWithExpressionFilter ¶ added in v8.3.0
func NewGeoRegionsContainingPointForCollectionWithExpressionFilter(expression *Expression, collectionType IndexCollectionType, point string) *Filter
NewGeoRegionsContainingPointForCollectionWithExpressionFilter creates a geospatial "containing point" filter for query on collection index with an expression. Argument must be a valid GeoJSON point.
func NewGeoRegionsContainingPointForCollectionWithIndexNameFilter ¶ added in v8.3.0
func NewGeoRegionsContainingPointForCollectionWithIndexNameFilter(indexName string, collectionType IndexCollectionType, point string) *Filter
NewGeoRegionsContainingPointForCollectionWithIndexNameFilter creates a geospatial "containing point" filter for query on collection index with an index name. Argument must be a valid GeoJSON point.
func NewGeoRegionsContainingPointWithExpressionFilter ¶ added in v8.3.0
func NewGeoRegionsContainingPointWithExpressionFilter(expression *Expression, point string) *Filter
NewGeoRegionsContainingPointWithExpressionFilter creates a geospatial "containing point" filter for query with an expression. Argument must be a valid GeoJSON point.
func NewGeoRegionsContainingPointWithIndexNameFilter ¶ added in v8.3.0
NewGeoRegionsContainingPointWithIndexNameFilter creates a geospatial "containing point" filter for query with an index name. Argument must be a valid GeoJSON point.
func NewGeoWithinRadiusFilter ¶
func NewGeoWithinRadiusFilter(binName string, lng, lat, radius float64, ctx ...*CDTContext) *Filter
NewGeoWithinRadiusFilter creates a geospatial "within radius" filter for query. Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRadiusForCollectionFilter ¶
func NewGeoWithinRadiusForCollectionFilter(binName string, collectionType IndexCollectionType, lng, lat, radius float64, ctx ...*CDTContext) *Filter
NewGeoWithinRadiusForCollectionFilter creates a geospatial "within radius" filter for query on collection index. Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRadiusForCollectionWithExpressionFilter ¶ added in v8.3.0
func NewGeoWithinRadiusForCollectionWithExpressionFilter(expression *Expression, collectionType IndexCollectionType, lng, lat, radius float64) *Filter
NewGeoWithinRadiusForCollectionWithExpressionFilter creates a geospatial "within radius" filter for query on collection index with an expression. Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRadiusForCollectionWithIndexNameFilter ¶ added in v8.3.0
func NewGeoWithinRadiusForCollectionWithIndexNameFilter(indexName string, collectionType IndexCollectionType, lng, lat, radius float64) *Filter
NewGeoWithinRadiusForCollectionWithIndexNameFilter creates a geospatial "within radius" filter for query on collection index with an index name. Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRadiusWithExpressionFilter ¶ added in v8.3.0
func NewGeoWithinRadiusWithExpressionFilter(expression *Expression, lng, lat, radius float64) *Filter
NewGeoWithinRadiusWithExpressionFilter creates a geospatial "within radius" filter for query with an expression. Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRadiusWithIndexNameFilter ¶ added in v8.3.0
NewGeoWithinRadiusWithIndexNameFilter creates a geospatial "within radius" filter for query with an index name. Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRegionFilter ¶
func NewGeoWithinRegionFilter(binName, region string, ctx ...*CDTContext) *Filter
NewGeoWithinRegionFilter creates a geospatial "within region" filter for query. Argument must be a valid GeoJSON region.
func NewGeoWithinRegionForCollectionFilter ¶
func NewGeoWithinRegionForCollectionFilter(binName string, collectionType IndexCollectionType, region string, ctx ...*CDTContext) *Filter
NewGeoWithinRegionForCollectionFilter creates a geospatial "within region" filter for query on collection index. Argument must be a valid GeoJSON region.
func NewGeoWithinRegionForCollectionWithExpressionFilter ¶ added in v8.3.0
func NewGeoWithinRegionForCollectionWithExpressionFilter(expression *Expression, collectionType IndexCollectionType, region string) *Filter
NewGeoWithinRegionForCollectionWithExpressionFilter creates a geospatial "within region" filter for query on collection index with an expression. Argument must be a valid GeoJSON region.
func NewGeoWithinRegionForCollectionWithIndexNameFilter ¶ added in v8.3.0
func NewGeoWithinRegionForCollectionWithIndexNameFilter(indexName string, collectionType IndexCollectionType, region string) *Filter
NewGeoWithinRegionForCollectionWithIndexNameFilter creates a geospatial "within region" filter for query on collection index with an index name. Argument must be a valid GeoJSON region.
func NewGeoWithinRegionWithExpressionFilter ¶ added in v8.3.0
func NewGeoWithinRegionWithExpressionFilter(expression *Expression, region string) *Filter
NewGeoWithinRegionWithExpressionFilter creates a geospatial "within region" filter for query with an expression. Argument must be a valid GeoJSON region.
func NewGeoWithinRegionWithIndexNameFilter ¶ added in v8.3.0
NewGeoWithinRegionWithIndexNameFilter creates a geospatial "within region" filter for query with an index name. Argument must be a valid GeoJSON region.
func NewRangeFilter ¶
func NewRangeFilter(binName string, begin int64, end int64, ctx ...*CDTContext) *Filter
NewRangeFilter creates a range filter for query. Range arguments must be int64 values. String ranges are not supported.
func NewRangeWithExpressionFilter ¶ added in v8.3.0
func NewRangeWithExpressionFilter(expression *Expression, begin int64, end int64) *Filter
NewRangeWithExpressionFilter creates a range filter for query with an expression. Range arguments must be int64 values. String ranges are not supported.
func NewRangeWithIndexNameFilter ¶ added in v8.3.0
NewRangeWithIndexNameFilter creates a range filter for query with an index name. Range arguments must be int64 values. String ranges are not supported.
func NewWithExpressionFilter ¶ added in v8.3.0
func NewWithExpressionFilter(expression *Expression, indexCollectionType IndexCollectionType, valueParticleType int, begin Value, end Value) *Filter
NewWithExpressionFilter creates a filter for query with an expression. Range arguments must be longs or integers which can be cast to longs. String ranges are not supported.
func NewWithIndexNameFilter ¶ added in v8.3.0
func NewWithIndexNameFilter(indexName string, indexCollectionType IndexCollectionType, valueParticleType int, begin Value, end Value) *Filter
NewWithIndexNameFilter creates a filter for query with an index name. Range arguments must be longs or integers which can be cast to longs. String ranges are not supported.
func (*Filter) EstimateSize ¶
EstimateSize will estimate the size of the filter for wire protocol
func (*Filter) IndexCollectionType ¶
func (fltr *Filter) IndexCollectionType() IndexCollectionType
IndexCollectionType returns filter's index type.
type FloatValue ¶
type FloatValue float64
FloatValue encapsulates an float64 value.
func NewFloatValue ¶
func NewFloatValue(value float64) FloatValue
NewFloatValue generates a FloatValue instance.
func (FloatValue) EstimateSize ¶
func (vl FloatValue) EstimateSize() (int, Error)
EstimateSize returns the size of the FloatValue in wire protocol.
func (FloatValue) GetObject ¶
func (vl FloatValue) GetObject() any
GetObject returns original value as an any.
func (FloatValue) GetType ¶
func (vl FloatValue) GetType() int
GetType returns wire protocol value type.
func (FloatValue) String ¶
func (vl FloatValue) String() string
String implements Stringer interface.
type GenerationPolicy ¶
type GenerationPolicy int
GenerationPolicy determines how to handle record writes based on record generation.
const ( // NONE means: Do not use record generation to restrict writes. NONE GenerationPolicy = iota // EXPECT_GEN_EQUAL means: Update/Delete record if expected generation is equal to server generation. Otherwise, fail. EXPECT_GEN_EQUAL // EXPECT_GEN_GT means: Update/Delete record if expected generation greater than the server generation. Otherwise, fail. // This is useful for restore after backup. EXPECT_GEN_GT )
type GeoJSONValue ¶
type GeoJSONValue string
GeoJSONValue encapsulates a 2D Geo point. Supported by Aerospike 3.6.1 servers and later only.
func NewGeoJSONValue ¶
func NewGeoJSONValue(value string) GeoJSONValue
NewGeoJSONValue generates a GeoJSONValue instance.
func (GeoJSONValue) EstimateSize ¶
func (vl GeoJSONValue) EstimateSize() (int, Error)
EstimateSize returns the size of the GeoJSONValue in wire protocol.
func (GeoJSONValue) GetObject ¶
func (vl GeoJSONValue) GetObject() any
GetObject returns original value as an any.
func (GeoJSONValue) GetType ¶
func (vl GeoJSONValue) GetType() int
GetType returns wire protocol value type.
func (GeoJSONValue) String ¶
func (vl GeoJSONValue) String() string
String implements Stringer interface.
type HLLPolicy ¶
type HLLPolicy struct {
// contains filtered or unexported fields
}
HLLPolicy determines the HyperLogLog operation policy.
func DefaultHLLPolicy ¶
func DefaultHLLPolicy() *HLLPolicy
DefaultHLLPolicy uses the default policy when performing HLL operations.
func NewHLLPolicy ¶
NewHLLPolicy uses specified HLLWriteFlags when performing HLL operations.
type HLLValue ¶
type HLLValue []byte
HLLValue encapsulates a HyperLogLog value.
func NewHLLValue ¶
NewHLLValue generates a ByteValue instance.
func (HLLValue) EstimateSize ¶
EstimateSize returns the size of the HLLValue in wire protocol.
type Host ¶
type Host struct {
// Host name or IP address of database server.
Name string
//TLSName defines the TLS certificate name used for secure connections.
TLSName string
// Port of database server.
Port int
}
Host name/port of database server.
func (*Host) IsLocalhost ¶ added in v8.4.0
IsLocalhost returns true if the host name or IP address represents localhost. This includes "localhost", IPv4 loopback addresses (127.x.x.x), and IPv6 loopback (::1).
type IndexCollectionType ¶
type IndexCollectionType int
IndexCollectionType is the secondary index collection type.
const ( // ICT_DEFAULT is the Normal scalar index. ICT_DEFAULT IndexCollectionType = iota // ICT_LIST is Index list elements. ICT_LIST // ICT_MAPKEYS is Index map keys. ICT_MAPKEYS // ICT_MAPVALUES is Index map values. ICT_MAPVALUES // ICT_SET is a set index. No bin, type, context, or expression parameters are used. // Requires server version 8.1.2+. ICT_SET )
func (IndexCollectionType) String ¶
func (ict IndexCollectionType) String() string
type IndexTask ¶
type IndexTask struct {
// contains filtered or unexported fields
}
IndexTask is used to poll for long running create index completion.
func NewIndexTask ¶
NewIndexTask initializes a task with fields needed to query server nodes.
func (*IndexTask) OnComplete ¶
OnComplete returns a channel that will be closed as soon as the task is finished. If an error is encountered during operation, an error will be sent on the channel.
type IndexType ¶
type IndexType string
IndexType the type of the secondary index.
const ( // NUMERIC specifies an index on numeric values. // Use for server versions prior to 8.2.0. For server versions 8.2.0 and later, // use INTEGER instead. NUMERIC IndexType = "NUMERIC" // INTEGER specifies an index on integer values for server versions 8.2.0+. // Use NUMERIC for server versions prior to 8.2.0. INTEGER IndexType = "INTEGER" // STRING specifies an index on string values. STRING IndexType = "STRING" // BLOB specifies a []byte index. Requires server version 7.0+. BLOB IndexType = "BLOB" // GEO2DSPHERE specifies 2-dimensional spherical geospatial index. GEO2DSPHERE IndexType = "GEO2DSPHERE" )
type InfinityValue ¶
type InfinityValue struct{}
InfinityValue is an empty value.
func NewInfinityValue ¶
func NewInfinityValue() InfinityValue
NewInfinityValue generates a InfinityValue instance.
func (InfinityValue) EstimateSize ¶
func (vl InfinityValue) EstimateSize() (int, Error)
EstimateSize returns the size of the InfinityValue in wire protocol.
func (InfinityValue) GetObject ¶
func (vl InfinityValue) GetObject() any
GetObject returns original value as an any.
func (InfinityValue) GetType ¶
func (vl InfinityValue) GetType() int
GetType returns wire protocol value type.
func (InfinityValue) String ¶
func (vl InfinityValue) String() string
type InfoPolicy ¶
type InfoPolicy struct {
// Info command socket timeout.
// Default is 2 seconds.
Timeout time.Duration
}
InfoPolicy contains attributes used for info commands.
func NewInfoPolicy ¶
func NewInfoPolicy() *InfoPolicy
NewInfoPolicy generates a new InfoPolicy with default values.
type IntegerValue ¶
type IntegerValue int
IntegerValue encapsulates an integer value.
func NewIntegerValue ¶
func NewIntegerValue(value int) IntegerValue
NewIntegerValue generates an IntegerValue instance.
func (IntegerValue) EstimateSize ¶
func (vl IntegerValue) EstimateSize() (int, Error)
EstimateSize returns the size of the IntegerValue in wire protocol.
func (IntegerValue) GetObject ¶
func (vl IntegerValue) GetObject() any
GetObject returns original value as an any.
func (IntegerValue) GetType ¶
func (vl IntegerValue) GetType() int
GetType returns wire protocol value type.
func (IntegerValue) String ¶
func (vl IntegerValue) String() string
String implements Stringer interface.
type JsonValue ¶
JsonValue encapsulates a Json map. Supported by Aerospike 3+ servers only.
func NewJsonValue ¶
NewJsonValue generates a JsonValue instance.
func (JsonValue) EstimateSize ¶
EstimateSize returns the size of the JsonValue in wire protocol.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key is the unique record identifier. Records can be identified using a specified namespace, an optional set name, and a user defined key which must be unique within a set. Records can also be identified by namespace/digest which is the combination used on the server.
func (*Key) PartitionId ¶
PartitionId returns the partition that the key belongs to.
func (*Key) SetValue ¶
SetValue sets the Key's value and recompute's its digest without allocating new memory. This allows the keys to be reusable.
type Labels ¶ added in v8.3.0
The reason this is a slice of maps is because we are carrying multiple sets of labels one for each node in the cluster.
type Language ¶
type Language string
Language specifies User defined function languages.
const ( // LUA embedded programming language. LUA Language = "LUA" )
type ListIter ¶
ListIter allows to define general maps of your own type to be used in the Go client without the use of reflection. function PackList should be exactly Like the following (Do not change, just copy/paste and adapt PackXXX methods):
func (cs *CustomSlice) PackList(buf aerospike.BufferEx) (int, error) {
size := 0
for _, elem := range cs {
n, err := PackXXX(buf, elem)
size += n
if err != nil {
return size, err
}
}
return size, nil
}
Example (Int) ¶
package main
import (
"fmt"
"log"
as "github.com/aerospike/aerospike-client-go/v8"
)
/*
myListInt
*/
var _ as.ListIter = myListInt([]int{})
// your custom list
type myListInt []int
func (ml myListInt) PackList(buf as.BufferEx) (int, error) {
size := 0
for _, elem := range ml {
n, err := as.PackInt64(buf, int64(elem))
size += n
if err != nil {
return size, err
}
}
return size, nil
}
func (ml myListInt) Len() int {
return len(ml)
}
func main() {
// Setup the client here
// client, err := as.NewClient("127.0.0.1", 3000)
// if err != nil {
// log.Fatal(err)
// }
var v as.Value = as.NewValue(myListInt([]int{1, 2, 3}))
key, err := as.NewKey(*namespace, "test", 1)
if err != nil {
log.Fatal(err)
}
err = client.Put(nil, key, as.BinMap{"myBin": v})
if err != nil {
log.Fatal(err)
}
rec, err := client.Get(nil, key)
if err != nil {
log.Fatal(err)
}
fmt.Println(rec.Bins["myBin"])
}
Output: [1 2 3]
Example (String) ¶
package main
import (
"fmt"
"log"
as "github.com/aerospike/aerospike-client-go/v8"
)
/*
myListString
*/
var _ as.ListIter = myListString([]string{})
// your custom list
type myListString []string
func (ml myListString) PackList(buf as.BufferEx) (int, error) {
size := 0
for _, elem := range ml {
n, err := as.PackString(buf, elem)
size += n
if err != nil {
return size, err
}
}
return size, nil
}
func (ml myListString) Len() int {
return len(ml)
}
func main() {
// Setup the client here
// client, err := as.NewClient("127.0.0.1", 3000)
// if err != nil {
// log.Fatal(err)
// }
var v as.Value = as.NewValue(myListString([]string{"a", "b", "c"}))
key, err := as.NewKey(*namespace, "test", 1)
if err != nil {
log.Fatal(err)
}
err = client.Put(nil, key, as.BinMap{"myBin": v})
if err != nil {
log.Fatal(err)
}
rec, err := client.Get(nil, key)
if err != nil {
log.Fatal(err)
}
fmt.Println(rec.Bins["myBin"])
}
Output: [a b c]
Example (Time) ¶
package main
import (
"fmt"
"log"
"time"
as "github.com/aerospike/aerospike-client-go/v8"
)
/*
myListTime
*/
var _ as.ListIter = myListTime([]time.Time{})
// your custom list
type myListTime []time.Time
func (ml myListTime) PackList(buf as.BufferEx) (int, error) {
size := 0
for _, elem := range ml {
n, err := as.PackInt64(buf, elem.UnixNano())
size += n
if err != nil {
return size, err
}
}
return size, nil
}
func (ml myListTime) Len() int {
return len(ml)
}
func main() {
// Setup the client here
// client, err := as.NewClient("127.0.0.1", 3000)
// if err != nil {
// log.Fatal(err)
// }
now1 := time.Unix(123123123, 0)
now2 := time.Unix(123123124, 0)
now3 := time.Unix(123123125, 0)
var v as.Value = as.NewValue(myListTime([]time.Time{now1, now2, now3}))
key, err := as.NewKey(*namespace, "test", 1)
if err != nil {
log.Fatal(err)
}
err = client.Put(nil, key, as.BinMap{"myBin": v})
if err != nil {
log.Fatal(err)
}
rec, err := client.Get(nil, key)
if err != nil {
log.Fatal(err)
}
fmt.Println(rec.Bins["myBin"])
}
Output: [123123123000000000 123123124000000000 123123125000000000]
type ListOrderType ¶
type ListOrderType int
ListOrderType determines the order of returned values in CDT list operations.
const ( // ListOrderUnordered signifies that list is not ordered. This is the default. ListOrderUnordered ListOrderType = 0 // ListOrderOrdered signifies that list is Ordered. ListOrderOrdered ListOrderType = 1 )
Map storage order.
type ListPolicy ¶
type ListPolicy struct {
// contains filtered or unexported fields
}
ListPolicy directives when creating a list and writing list items.
func DefaultListPolicy ¶
func DefaultListPolicy() *ListPolicy
DefaultListPolicy returns the default policy for CDT list operations.
func NewListPolicy ¶
func NewListPolicy(order ListOrderType, flags int) *ListPolicy
NewListPolicy creates a policy with directives when creating a list and writing list items. Flags are ListWriteFlags. You can specify multiple by `or`ing them together.
type ListReturnType ¶
type ListReturnType int
ListReturnType determines the returned values in CDT List operations.
const ( // ListReturnTypeNone will not return a result. ListReturnTypeNone ListReturnType = 0 // ListReturnTypeIndex will return index offset order. // 0 = first key // N = Nth key // -1 = last key ListReturnTypeIndex ListReturnType = 1 // ListReturnTypeReverseIndex will return reverse index offset order. // 0 = last key // -1 = first key ListReturnTypeReverseIndex ListReturnType = 2 // ListReturnTypeRank will return value order. // 0 = smallest value // N = Nth smallest value // -1 = largest value ListReturnTypeRank ListReturnType = 3 // ListReturnTypeReverseRank will return reverse value order. // 0 = largest value // N = Nth largest value // -1 = smallest value ListReturnTypeReverseRank ListReturnType = 4 // ListReturnTypeCount will return count of items selected. ListReturnTypeCount ListReturnType = 5 // ListReturnTypeValue will return value for single key read and value list for range read. ListReturnTypeValue ListReturnType = 7 // ListReturnTypeExists returns true if count > 0. ListReturnTypeExists ListReturnType = 13 // ListReturnTypeInverted will invert meaning of list command and return values. For example: // ListOperation.getByIndexRange(binName, index, count, ListReturnType.INDEX | ListReturnType.INVERTED) // With the INVERTED flag enabled, the items outside of the specified index range will be returned. // The meaning of the list command can also be inverted. For example: // ListOperation.removeByIndexRange(binName, index, count, ListReturnType.INDEX | ListReturnType.INVERTED); // With the INVERTED flag enabled, the items outside of the specified index range will be removed and returned. ListReturnTypeInverted ListReturnType = 0x10000 )
type ListSortFlags ¶
type ListSortFlags int
ListSortFlags determines sort flags for CDT lists
const ( // ListSortFlagsDefault is the default sort flag for CDT lists, and sort in Ascending order. ListSortFlagsDefault ListSortFlags = 0 // ListSortFlagsDescending will sort the contents of the list in descending order. ListSortFlagsDescending ListSortFlags = 1 // ListSortFlagsDropDuplicates will drop duplicate values in the results of the CDT list operation. ListSortFlagsDropDuplicates ListSortFlags = 2 )
type ListValue ¶
type ListValue []any
ListValue encapsulates any arbitrary array. Supported by Aerospike 3+ servers only.
func NewListValue ¶
NewListValue generates a ListValue instance.
func (ListValue) EstimateSize ¶
EstimateSize returns the size of the ListValue in wire protocol.
type ListerValue ¶
type ListerValue struct {
// contains filtered or unexported fields
}
ListerValue encapsulates any arbitrary array. Supported by Aerospike 3+ servers only.
func NewListerValue ¶
func NewListerValue(list ListIter) *ListerValue
NewListerValue generates a NewListerValue instance.
func (*ListerValue) EstimateSize ¶
func (vl *ListerValue) EstimateSize() (int, Error)
EstimateSize returns the size of the ListerValue in wire protocol.
func (*ListerValue) GetObject ¶
func (vl *ListerValue) GetObject() any
GetObject returns original value as an any.
func (*ListerValue) GetType ¶
func (vl *ListerValue) GetType() int
GetType returns wire protocol value type.
func (*ListerValue) String ¶
func (vl *ListerValue) String() string
String implements Stringer interface.
type LongValue ¶
type LongValue int64
LongValue encapsulates an int64 value.
func NewLongValue ¶
NewLongValue generates a LongValue instance.
func (LongValue) EstimateSize ¶
EstimateSize returns the size of the LongValue in wire protocol.
type LoopVarPart ¶ added in v8.6.0
type LoopVarPart uint
var ( MAP_KEY LoopVarPart = 0 VALUE LoopVarPart = 1 INDEX LoopVarPart = 2 )
type MapIter ¶
MapIter allows to define general maps of your own type to be used in the Go client without the use of reflection. function PackMap should be exactly Like the following (Do not change, just copy/paste and adapt PackXXX methods):
func (cm *CustomMap) PackMap(buf aerospike.BufferEx) (int, error) {
size := 0
for k, v := range cm {
n, err := PackXXX(buf, k)
size += n
if err != nil {
return size, err
}
n, err = PackXXX(buf, v)
size += n
if err != nil {
return size, err
}
}
return size, nil
}
Example ¶
package main
import (
"fmt"
"log"
"time"
as "github.com/aerospike/aerospike-client-go/v8"
)
/*
myMapStringTime
*/
var _ as.MapIter = myMapStringTime(map[string]time.Time{})
// your custom list
type myMapStringTime map[string]time.Time
func (mm myMapStringTime) PackMap(buf as.BufferEx) (int, error) {
size := 0
for key, val := range mm {
n, err := as.PackString(buf, key)
size += n
if err != nil {
return size, err
}
n, err = as.PackInt64(buf, val.UnixNano())
size += n
if err != nil {
return size, err
}
}
return size, nil
}
func (mm myMapStringTime) Len() int {
return len(mm)
}
func main() {
// Setup the client here
// client, err := as.NewClient("127.0.0.1", 3000)
// if err != nil {
// log.Fatal(err)
// }
now := time.Unix(123123123, 0)
var v as.Value = as.NewValue(myMapStringTime(map[string]time.Time{"now": now}))
key, err := as.NewKey(*namespace, "test", 1)
if err != nil {
log.Fatal(err)
}
err = client.Put(nil, key, as.BinMap{"myBin": v})
if err != nil {
log.Fatal(err)
}
rec, err := client.Get(nil, key)
if err != nil {
log.Fatal(err)
}
fmt.Println(rec.Bins["myBin"])
}
Output: map[now:123123123000000000]
type MapOrderTypes ¶
type MapOrderTypes = mapOrderType
MapOrderTypes exports the type of individual MapOrderType values
type MapPair ¶
type MapPair struct{ Key, Value any }
MapPair is used when the client returns sorted maps from the server Since the default map in Go is a hash map, we will use a slice to return the results in server order
type MapPolicy ¶
type MapPolicy struct {
// contains filtered or unexported fields
}
MapPolicy directives when creating a map and writing map items.
func DefaultMapPolicy ¶
func DefaultMapPolicy() *MapPolicy
DefaultMapPolicy returns the default map policy
func NewMapPolicy ¶
func NewMapPolicy(order mapOrderType, writeMode *mapWriteMode) *MapPolicy
NewMapPolicy creates a MapPolicy with WriteMode. Use with servers before v4.3.
func NewMapPolicyWithFlags ¶
NewMapPolicyWithFlags creates a MapPolicy with WriteFlags. Use with servers v4.3+. Flags are MapWriteFlags. You can specify multiple flags by 'or'ing them together.
func NewMapPolicyWithFlagsAndPersistedIndex ¶
NewMapPolicyWithFlagsAndPersistedIndex creates a MapPolicy with WriteFlags that persists the map index. A map index improves lookup performance, but requires more storage. A map index can be created for a top-level ordered map only. Nested and unordered map indexes are not supported. Use with servers v7+. Flags are MapWriteFlags. You can specify multiple flags by 'or'ing them together.
type MapReturnTypes ¶
type MapReturnTypes = mapReturnType
MapReturnTypes exports the type of individual MapReturnType values
type MapValue ¶
MapValue encapsulates an arbitrary map. Supported by Aerospike 3+ servers only.
func NewMapValue ¶
NewMapValue generates a MapValue instance.
func (MapValue) EstimateSize ¶
EstimateSize returns the size of the MapValue in wire protocol.
type MapWriteModes ¶
type MapWriteModes = mapWriteMode
MapWriteModes exports the type of individual MapWriteMode values
type MapperValue ¶
type MapperValue struct {
// contains filtered or unexported fields
}
MapperValue encapsulates an arbitrary map which implements a MapIter interface. Supported by Aerospike 3+ servers only.
func NewMapperValue ¶
func NewMapperValue(vmap MapIter) *MapperValue
NewMapperValue generates a MapperValue instance.
func (*MapperValue) EstimateSize ¶
func (vl *MapperValue) EstimateSize() (int, Error)
EstimateSize returns the size of the MapperValue in wire protocol.
func (*MapperValue) GetObject ¶
func (vl *MapperValue) GetObject() any
GetObject returns original value as an any.
func (*MapperValue) GetType ¶
func (vl *MapperValue) GetType() int
GetType returns wire protocol value type.
func (*MapperValue) String ¶
func (vl *MapperValue) String() string
type MetricsPolicy ¶
type MetricsPolicy struct {
// Histogram type specifies if the histogram should be [histogram.Linear] or [histogram.Logarithmic].
//
// Default: [histogram.Logarithmic]
HistogramType histogram.Type
// LatencyColumns defines the number of elapsed time range buckets in latency histograms.
//
// Default: 24
LatencyColumns int //= 24;
// Depending on the type of histogram:
//
// For logarithmic histograms, the buckets are: <base^1 <base^2 <base^3 ... >=base^(columns-1)
//
// // LatencyColumns=5 latencyBase=8
// <8µs <64µs <512µs <4096µs >=4096
//
// // LatencyColumns=7 LatencyBase=4
// <4µs <16µs <64µs <256µs <1024µs <4096 >=4096µs
//
// For linear histograms, the buckets are: <base <base*2 <base*3 ... >=base*(column-1)
//
// // LatencyColumns=5 latencyBase=15
// <15µs <30µs <45µs <60µs >=60µs
//
// // LatencyColumns=7 LatencyBase=5
// <5µs <10µs <15µs <20µs <25µs <30µs >=30µs
//
// Default: 2
LatencyBase int //= 2;
// User provided labels which will appended to the metrics on export. This
// information is used downstream by metrics aggregetators to group/identify metrics
// collected by the client.
Labels *Labels
}
MetricsPolicy specifies client periodic metrics configuration.
func DefaultMetricsPolicy ¶
func DefaultMetricsPolicy() *MetricsPolicy
NewMetricsPolicy creates a new MetricsPolicy with predefined set of default parameters.
func DefaultMetricsPolicyWithLabels ¶ added in v8.3.0
func DefaultMetricsPolicyWithLabels(pairs ...map[string]string) *MetricsPolicy
DefaultMetricsPolicyWithLabels creates a new MetricsPolicy with the provided labels. The labels are used to identify the metrics collected by the client.
type ModifyFlag ¶ added in v8.6.0
type ModifyFlag int
const ( // If the expression in the context hits an invalid type, the operation // will fail. This is the default behavior. EXP_PATH_MODIFY_DEFAULT ModifyFlag = 0x00 // If the expression in the context hits an invalid type (e.g., selects // as an integer when the value is a string), do not fail the operation; // just ignore those elements. Interpret UNKNOWN as false instead. EXP_PATH_MODIFY_NO_FAIL ModifyFlag = 0x10 )
type MultiPolicy ¶
type MultiPolicy struct {
BasePolicy
// Maximum number of concurrent requests to server nodes at any point in time.
// If there are 16 nodes in the cluster and maxConcurrentNodes is 8, then queries
// will be made to 8 nodes in parallel. When a query completes, a new query will
// be issued until all 16 nodes have been queried.
// Default (0) is to issue requests to all server nodes in parallel.
// 1 will to issue requests to server nodes one by one avoiding parallel queries.
MaxConcurrentNodes int
// MaxRecords approximates the number of records to return to the client. This number is divided by the
// number of nodes involved in the query. The actual number of records returned
// may be less than MaxRecords if node record counts are small and unbalanced across
// nodes.
//
// This field is supported on server versions >= 4.9.
//
// Default: 0 (do not limit record count)
MaxRecords int64
// RecordsPerSecond limits returned records per second (rps) rate for each server.
// It does not apply rps limit if RecordsPerSecond is zero (default).
//
// RecordsPerSecond is supported in all primary and secondary index
// queries in server versions 6.0+. For background queries, RecordsPerSecond
// is bounded by the server config background-query-max-rps.
RecordsPerSecond int
// Number of records to place in queue before blocking.
// Records received from multiple server nodes will be placed in a queue.
// A separate goroutine consumes these records in parallel.
// If the queue is full, the producer goroutines will block until records are consumed.
RecordQueueSize int //= 50
// Indicates if bin data is retrieved. If false, only record digests are retrieved.
IncludeBinData bool //= true;
// RawCDT specifies that the value of the CDT fields (Maps and Lists) should not be unpacked/decoded.
// This is only used internally by Aerospike for Backup purposes and should not be used by 3rd parties.
RawCDT bool
}
MultiPolicy contains parameters for policy attributes used in query and scan operations.
func NewMultiPolicy ¶
func NewMultiPolicy() *MultiPolicy
NewMultiPolicy initializes a MultiPolicy instance with default values. It disables TotalTimeout and sets MaxRetries. Set MaxRetries for non-aggregation queries with a nil filter on server versions >= 4.9. All other queries are not retried.
The latest servers support retries on individual data partitions. This feature is useful when a cluster is migrating and partition(s) are missed or incomplete on the first query attempt.
If the first query attempt misses 2 of 4096 partitions, then only those 2 partitions are retried in the next query attempt from the last key digest received for each respective partition. A higher default MaxRetries is used because it's wasteful to invalidate all query results because a single partition was missed.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents an Aerospike Database Server Node
func (*Node) Close ¶
func (nd *Node) Close()
Close marks node as inactive and closes all of its pooled connections.
func (*Node) GetConnection ¶
func (nd *Node) GetConnection(timeout time.Duration) (conn *Connection, err Error)
GetConnection gets a connection to the node. If no pooled connection is available, a new connection will be created, unless ClientPolicy.MaxQueueSize number of connections are already created. This method will retry to retrieve a connection in case the connection pool is empty, until timeout is reached.
func (*Node) GetServerVersion ¶ added in v8.4.2
func (*Node) InvalidateConnection ¶
func (nd *Node) InvalidateConnection(conn *Connection)
InvalidateConnection closes and discards a connection from the pool.
func (*Node) MigrationInProgress ¶
MigrationInProgress determines if the node is participating in a data migration
func (*Node) PartitionGeneration ¶
PartitionGeneration returns node's Partition Generation
func (*Node) PeersGeneration ¶
PeersGeneration returns node's Peers Generation
func (*Node) PutConnection ¶
func (nd *Node) PutConnection(conn *Connection)
PutConnection puts back a connection to the pool. If connection pool is full, the connection will be closed and discarded.
func (*Node) RebalanceGeneration ¶
RebalanceGeneration returns node's Rebalance Generation
func (*Node) Refresh ¶
Refresh requests current status from server node, and updates node with the result.
func (*Node) RequestInfo ¶
RequestInfo gets info values by name from the specified database server node.
func (*Node) RequestStats ¶
func (nd *Node) RequestStats(policy *InfoPolicy) (map[string]string, Error)
RequestStats returns statistics for the specified node as a map
func (*Node) SupportsBatchAny ¶
SupportsBatchAny returns true if the node supports the feature.
func (*Node) SupportsPartitionQuery ¶
SupportsPartitionQuery returns true if the node supports the feature.
func (*Node) SupportsQueryOpsProjectionExt ¶ added in v8.7.0
SupportsQueryOpsProjectionExt returns true if the node supports extended read operations (CDT, expression, bit, HLL reads) in query operations projection. Requires server version 8.1.2+.
func (*Node) SupportsQueryShow ¶
SupportsQueryShow returns true if the node supports the feature.
func (*Node) WaitUntillMigrationIsFinished ¶
WaitUntillMigrationIsFinished will block until migration operations are finished.
func (*Node) WarmUp ¶
WarmUp fills the node's connection pool with connections. This is necessary on startup for high traffic programs. If the count is <= 0, the connection queue will be filled. If the count is more than the size of the pool, the pool will be filled. Note: One connection per node is reserved for tend operations and is not used for transactions.
type NullValue ¶
type NullValue struct{}
NullValue is an empty value.
func (NullValue) EstimateSize ¶
EstimateSize returns the size of the NullValue in wire protocol.
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
Operation contains operation definition. This struct is used in client's operate() method.
func AppendOp
deprecated
AppendOp creates string append database operation.
Deprecated: AppendOp has been deprecated since 8.8.0. Use StrAppendOp instead. This legacy operation performs a raw byte concatenation that is not Unicode/DBCS-aware; the string-package equivalent provides consistent Unicode handling and policy/CTX support.
func BitAddOp ¶
func BitAddOp( policy *BitPolicy, binName string, bitOffset int, bitSize int, value int64, signed bool, action BitOverflowAction, ctx ...*CDTContext, ) *Operation
BitAddOp creates bit "add" operation. Server adds value to []byte bin starting at bitOffset for bitSize. BitSize must be <= 64. Signed indicates if bits should be treated as a signed number. If add overflows/underflows, BitOverflowAction is used. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 24 bitSize = 16 value = 128 signed = false bin result = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b10000101]
func BitAndOp ¶
func BitAndOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value []byte, ctx ...*CDTContext) *Operation
BitAndOp creates bit "and" operation. Server performs bitwise "and" on value and []byte bin at bitOffset for bitSize. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 23 bitSize = 9 value = [0b00111100, 0b10000000] bin result = [0b00000001, 0b01000010, 0b00000010, 0b00000000, 0b00000101]
func BitB64EncodeOp ¶ added in v8.9.0
func BitB64EncodeOp(binName string, ctx ...*CDTContext) *Operation
BitB64EncodeOp creates bit "base64 encode" operation. Server returns the base64 text of the whole []byte bin. Example:
bin = [0b00000001, 0b01000010] returns "AUI="
func BitB64EncodeRangeOp ¶ added in v8.9.0
func BitB64EncodeRangeOp(binName string, byteOffset int, byteSize int, invertSize bool, ctx ...*CDTContext) *Operation
BitB64EncodeRangeOp creates bit "base64 encode" operation on a byte range. Server returns the base64 text of []byte bin starting at byteOffset for byteSize. A negative byteOffset starts backwards from the end of the bitmap. When invertSize is true, byteSize counts back from the end of the bitmap, so an inverted byteSize of 0 encodes through to the end. Example:
bin = [0b00000001, 0b01000010, 0b00000011] byteOffset = 1 byteSize = 2 invertSize = false returns "QgM="
func BitCountOp ¶
func BitCountOp(binName string, bitOffset int, bitSize int, ctx ...*CDTContext) *Operation
BitCountOp creates bit "count" operation. Server returns integer count of set bits from []byte bin starting at bitOffset for bitSize. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 20 bitSize = 4 returns 2
func BitGetIntOp ¶
func BitGetIntOp(binName string, bitOffset int, bitSize int, signed bool, ctx ...*CDTContext) *Operation
BitGetIntOp creates bit "get integer" operation. Server returns integer from []byte bin starting at bitOffset for bitSize. Signed indicates if bits should be treated as a signed number. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 8 bitSize = 16 signed = false returns 16899
func BitGetOp ¶
func BitGetOp(binName string, bitOffset int, bitSize int, ctx ...*CDTContext) *Operation
BitGetOp creates bit "get" operation. Server returns bits from []byte bin starting at bitOffset for bitSize. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 9 bitSize = 5 returns [0b1000000]
func BitInsertOp ¶
func BitInsertOp(policy *BitPolicy, binName string, byteOffset int, value []byte, ctx ...*CDTContext) *Operation
BitInsertOp creates byte "insert" operation. Server inserts value bytes into []byte bin at byteOffset. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] byteOffset = 1 value = [0b11111111, 0b11000111] bin result = [0b00000001, 0b11111111, 0b11000111, 0b01000010, 0b00000011, 0b00000100, 0b00000101]
func BitLScanOp ¶
func BitLScanOp(binName string, bitOffset int, bitSize int, value bool, ctx ...*CDTContext) *Operation
BitLScanOp creates bit "left scan" operation. Server returns integer bit offset of the first specified value bit in []byte bin starting at bitOffset for bitSize. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 24 bitSize = 8 value = true returns 5
func BitLShiftOp ¶
func BitLShiftOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, shift int, ctx ...*CDTContext) *Operation
BitLShiftOp creates bit "left shift" operation. Server shifts left []byte bin starting at bitOffset for bitSize. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 32 bitSize = 8 shift = 3 bin result = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00101000]
func BitNotOp ¶
func BitNotOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, ctx ...*CDTContext) *Operation
BitNotOp creates bit "not" operation. Server negates []byte bin starting at bitOffset for bitSize. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 25 bitSize = 6 bin result = [0b00000001, 0b01000010, 0b00000011, 0b01111010, 0b00000101]
func BitOrOp ¶
func BitOrOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value []byte, ctx ...*CDTContext) *Operation
BitOrOp creates bit "or" operation. Server performs bitwise "or" on value and []byte bin at bitOffset for bitSize. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 17 bitSize = 6 value = [0b10101000] bin result = [0b00000001, 0b01000010, 0b01010111, 0b00000100, 0b00000101]
func BitRScanOp ¶
func BitRScanOp(binName string, bitOffset int, bitSize int, value bool, ctx ...*CDTContext) *Operation
BitRScanOp creates bit "right scan" operation. Server returns integer bit offset of the last specified value bit in []byte bin starting at bitOffset for bitSize. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 32 bitSize = 8 value = true returns 7
func BitRShiftOp ¶
func BitRShiftOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, shift int, ctx ...*CDTContext) *Operation
BitRShiftOp creates bit "right shift" operation. Server shifts right []byte bin starting at bitOffset for bitSize. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 0 bitSize = 9 shift = 1 bin result = [0b00000000, 0b11000010, 0b00000011, 0b00000100, 0b00000101]
func BitRemoveOp ¶
func BitRemoveOp(policy *BitPolicy, binName string, byteOffset int, byteSize int, ctx ...*CDTContext) *Operation
BitRemoveOp creates byte "remove" operation. Server removes bytes from []byte bin at byteOffset for byteSize. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] byteOffset = 2 byteSize = 3 bin result = [0b00000001, 0b01000010]
func BitResizeOp ¶
func BitResizeOp(policy *BitPolicy, binName string, byteSize int, resizeFlags BitResizeFlags, ctx ...*CDTContext) *Operation
BitResizeOp creates byte "resize" operation. Server resizes []byte to byteSize according to resizeFlags (See BitResizeFlags). Server does not return a value. Example:
bin = [0b00000001, 0b01000010] byteSize = 4 resizeFlags = 0 bin result = [0b00000001, 0b01000010, 0b00000000, 0b00000000]
func BitSetIntOp ¶
func BitSetIntOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value int64, ctx ...*CDTContext) *Operation
BitSetIntOp creates bit "setInt" operation. Server sets value to []byte bin starting at bitOffset for bitSize. Size must be <= 64. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 1 bitSize = 8 value = 127 bin result = [0b00111111, 0b11000010, 0b00000011, 0b0000100, 0b00000101]
func BitSetOp ¶
func BitSetOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value []byte, ctx ...*CDTContext) *Operation
BitSetOp creates bit "set" operation. Server sets value on []byte bin at bitOffset for bitSize. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 13 bitSize = 3 value = [0b11100000] bin result = [0b00000001, 0b01000111, 0b00000011, 0b00000100, 0b00000101]
func BitSubtractOp ¶
func BitSubtractOp( policy *BitPolicy, binName string, bitOffset int, bitSize int, value int64, signed bool, action BitOverflowAction, ctx ...*CDTContext, ) *Operation
BitSubtractOp creates bit "subtract" operation. Server subtracts value from []byte bin starting at bitOffset for bitSize. BitSize must be <= 64. Signed indicates if bits should be treated as a signed number. If add overflows/underflows, BitOverflowAction is used. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 24 bitSize = 16 value = 128 signed = false bin result = [0b00000001, 0b01000010, 0b00000011, 0b0000011, 0b10000101]
func BitXorOp ¶
func BitXorOp(policy *BitPolicy, binName string, bitOffset int, bitSize int, value []byte, ctx ...*CDTContext) *Operation
BitXorOp creates bit "exclusive or" operation. Server performs bitwise "xor" on value and []byte bin at bitOffset for bitSize. Server does not return a value. Example:
bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] bitOffset = 17 bitSize = 6 value = [0b10101100] bin result = [0b00000001, 0b01000010, 0b01010101, 0b00000100, 0b00000101]
func ExpReadOp ¶
func ExpReadOp(name string, exp *Expression, flags ExpReadFlags) *Operation
ExpReadOp creates an operation with an expression that reads from a record.
func ExpWriteOp ¶
func ExpWriteOp(binName string, exp *Expression, flags ExpWriteFlags) *Operation
ExpWriteOp creates an operation with an expression that writes to record bin.
func GetHeaderOp ¶
func GetHeaderOp() *Operation
GetHeaderOp creates read record header database operation.
func HLLAddOp ¶
func HLLAddOp(policy *HLLPolicy, binName string, list []Value, indexBitCount, minHashBitCount int) *Operation
HLLAddOp creates HLL add operation with minhash bits. Server adds values to HLL set. If HLL bin does not exist, use indexBitCount and minHashBitCount to create HLL bin. Server returns number of entries that caused HLL to update a register.
policy write policy, use DefaultHLLPolicy for default binName name of bin list list of values to be added indexBitCount number of index bits. Must be between 4 and 16 inclusive. Pass -1 for default. minHashBitCount number of min hash bits. Must be between 4 and 58 inclusive. Pass -1 for default. indexBitCount + minHashBitCount must be <= 64.
func HLLDescribeOp ¶
HLLDescribeOp creates HLL describe operation. Server returns indexBitCount and minHashBitCount used to create HLL bin in a list of longs. The list size is 2.
binName name of bin
func HLLFoldOp ¶
HLLFoldOp creates HLL fold operation. Servers folds indexBitCount to the specified value. This can only be applied when minHashBitCount on the HLL bin is 0. Server does not return a value.
binName name of bin indexBitCount number of index bits. Must be between 4 and 16 inclusive.
func HLLGetCountOp ¶
HLLGetCountOp creates HLL getCount operation. Server returns estimated number of elements in the HLL bin.
binName name of bin
func HLLGetIntersectCountOp ¶
HLLGetIntersectCountOp creates HLL getIntersectCount operation. Server returns estimated number of elements that would be contained by the intersection of these HLL objects.
binName name of bin list list of HLL objects
func HLLGetSimilarityOp ¶
HLLGetSimilarityOp creates HLL getSimilarity operation. Server returns estimated similarity of these HLL objects. Return type is a double.
binName name of bin list list of HLL objects
func HLLGetUnionCountOp ¶
HLLGetUnionCountOp creates HLL getUnionCount operation. Server returns estimated number of elements that would be contained by the union of these HLL objects.
binName name of bin list list of HLL objects
func HLLGetUnionOp ¶
HLLGetUnionOp creates HLL getUnion operation. Server returns an HLL object that is the union of all specified HLL objects in the list with the HLL bin.
binName name of bin list list of HLL objects
func HLLInitOp ¶
HLLInitOp creates HLL init operation with minhash bits. Server creates a new HLL or resets an existing HLL. Server does not return a value.
policy write policy, use DefaultHLLPolicy for default binName name of bin indexBitCount number of index bits. Must be between 4 and 16 inclusive. Pass -1 for default. minHashBitCount number of min hash bits. Must be between 4 and 58 inclusive. Pass -1 for default. indexBitCount + minHashBitCount must be <= 64.
func HLLRefreshCountOp ¶
HLLRefreshCountOp creates HLL refresh operation. Server updates the cached count (if stale) and returns the count.
binName name of bin
func HLLSetUnionOp ¶
HLLSetUnionOp creates HLL set union operation. Server sets union of specified HLL objects with HLL bin. Server does not return a value.
policy write policy, use DefaultHLLPolicy for default binName name of bin list list of HLL objects
func ListAppendOp ¶
ListAppendOp creates a list append operation. Server appends values to end of list bin. Server returns list size on bin name. It will panic if no values have been passed.
Parameters:
- binName: Name of the bin containing the list
- values: One or more values to append
Example ¶
ExampleListAppendOp demonstrates appending items to a list bin.
key, err := as.NewKey(*namespace, "test", "example-list-append")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
record, err := client.Operate(nil, key,
as.ListAppendOp("tasks", "task1", "task2", "task3"),
as.GetBinOp("tasks"),
)
if err != nil {
log.Fatal(err)
}
results := record.Bins["tasks"].(as.OpResults)
fmt.Printf("size=%d list=%v\n", results[0], results[1])
Output: size=3 list=[task1 task2 task3]
func ListAppendWithPolicyContextOp ¶
func ListAppendWithPolicyContextOp(policy *ListPolicy, binName string, ctx []*CDTContext, values ...any) *Operation
ListAppendWithPolicyContextOp creates a list append operation. Server appends values to end of list bin. Server returns list size on bin name. It will panic if no values have been passed.
Example ¶
Demonstrates nested list operations:
(1) Append to the last list in a list-of-lists; (2) Append to the lowest-ranked list within a map key. Matches the package-level examples in cdt_list.go.
key, err := as.NewKey(*namespace, "test", "example-list-ctx")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
// Example 1: bin = [[7,9,5],[1,2,3],[6,5,4,1]] — append 11 to last list
list := []any{[]any{7, 9, 5}, []any{1, 2, 3}, []any{6, 5, 4, 1}}
_ = client.Put(nil, key, as.BinMap{"bin": list})
record, err := client.Operate(nil, key,
as.ListAppendWithPolicyContextOp(as.DefaultListPolicy(), "bin", []*as.CDTContext{as.CtxListIndex(-1)}, 11),
as.GetBinOp("bin"),
)
if err != nil {
log.Fatal(err)
}
// Last inner list becomes [6,5,4,1,11]
inner := record.Bins["bin"].(as.OpResults)[1].([]any)[2].([]any)
fmt.Println(inner)
// Example 2: bin = {key2:[[9],[2,4],[6,1,9]]} — append 11 to lowest-ranked list in "key2"
client.Delete(nil, key)
m := map[any]any{
"key1": []any{[]any{7, 9, 5}, []any{13}},
"key2": []any{[]any{9}, []any{2, 4}, []any{6, 1, 9}},
}
_ = client.Put(nil, key, as.BinMap{"bin": m})
record, err = client.Operate(nil, key,
as.ListAppendWithPolicyContextOp(as.DefaultListPolicy(), "bin", []*as.CDTContext{as.CtxMapKey(as.StringValue("key2")), as.CtxListRank(0)}, 11),
as.GetBinOp("bin"),
)
if err != nil {
log.Fatal(err)
}
// key2's lowest-ranked list [2,4] becomes [2,4,11]
resMap := record.Bins["bin"].(as.OpResults)[1].(map[any]any)
key2Lists := resMap["key2"].([]any)
fmt.Println(key2Lists[1])
Output: [6 5 4 1 11] [2 4 11]
func ListAppendWithPolicyOp ¶
func ListAppendWithPolicyOp(policy *ListPolicy, binName string, values ...any) *Operation
ListAppendWithPolicyOp creates a list append operation. Server appends values to end of list bin. Server returns list size on bin name. It will panic if no values have been passed.
func ListClearOp ¶
func ListClearOp(binName string, ctx ...*CDTContext) *Operation
ListClearOp creates a list clear operation. Server removes all items in list bin. Server does not return a result by default.
Parameters:
- binName: Name of the bin containing the list
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates clearing all items in a list bin.
key, err := as.NewKey(*namespace, "test", "example-list-clear")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("tasks", "a", "b", "c"))
_, err = client.Operate(nil, key, as.ListClearOp("tasks"))
if err != nil {
log.Fatal(err)
}
rec, _ := client.Get(nil, key, "tasks")
fmt.Println(rec.Bins["tasks"])
Output: []
func ListCreateOp ¶
func ListCreateOp(binName string, listOrder ListOrderType, pad bool, ctx ...*CDTContext) *Operation
ListCreateOp creates list create operation. Server creates list at given context level. The context is allowed to be beyond list boundaries only if pad is set to true. In that case, nil list entries will be inserted to satisfy the context position.
func ListCreateWithIndexOp ¶
func ListCreateWithIndexOp(binName string, listOrder ListOrderType, pad bool, ctx ...*CDTContext) *Operation
ListCreateOp creates list create operation with a persisted index. A list index improves lookup performance, but requires more storage. A list index can be created for a top-level ordered list only. Nested and unordered list indexes are not supported.
Server creates list at given context level. The context is allowed to be beyond list boundaries only if pad is set to true. In that case, nil list entries will be inserted to satisfy the context position.
func ListGetByIndexOp ¶
func ListGetByIndexOp(binName string, index int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByIndexOp creates a list get by index operation. Server selects list item identified by index and returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the list
- index: List index (0 = first, -1 = last)
- returnType: What to return (see ListReturnType constants)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates getting an item at index with return type.
key, err := as.NewKey(*namespace, "test", "example-list-get-by-index")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("items", "x", "y", "z"))
record, err := client.Operate(nil, key, as.ListGetByIndexOp("items", 1, as.ListReturnTypeValue))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["items"])
Output: y
func ListGetByIndexRangeCountOp ¶
func ListGetByIndexRangeCountOp(binName string, index, count int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByIndexRangeCountOp creates list get by index range operation. Server selects "count" list items starting at specified index and returns selected data specified by returnType.
func ListGetByIndexRangeOp ¶
func ListGetByIndexRangeOp(binName string, index int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByIndexRangeOp creates a list get by index range operation. Server selects list items starting at specified index to the end of list and returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the list
- index: Starting index (0 = first, -1 = last)
- returnType: What to return (see ListReturnType constants)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates getting items from an index to end of list.
key, err := as.NewKey(*namespace, "test", "example-list-index-range")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("items", "a", "b", "c", "d", "e"))
record, err := client.Operate(nil, key, as.ListGetByIndexRangeOp("items", 2, as.ListReturnTypeValue))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["items"])
Output: [c d e]
func ListGetByRankOp ¶
func ListGetByRankOp(binName string, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByRankOp creates a list get by rank operation. Server selects list item identified by rank and returns selected data specified by returnType.
Rank is the sorted index of the value: 0 = smallest value, -1 = largest value.
Parameters:
- binName: Name of the bin containing the list
- rank: Rank position (0 = lowest, -1 = highest)
- returnType: What to return (see ListReturnType constants)
- ctx: Optional CDT context for nested lists
Example ¶
ExampleListGetByRankOp demonstrates getting an item by rank (sorted order).
key, err := as.NewKey(*namespace, "test", "example-list-get-by-rank")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("scores", 50, 10, 30, 20, 40))
record, err := client.Operate(nil, key, as.ListGetByRankOp("scores", 0, as.ListReturnTypeValue))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["scores"])
Output: 10
func ListGetByRankRangeCountOp ¶
func ListGetByRankRangeCountOp(binName string, rank, count int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByRankRangeCountOp creates a list get by rank range operation. Server selects "count" list items starting at specified rank and returns selected data specified by returnType.
func ListGetByRankRangeOp ¶
func ListGetByRankRangeOp(binName string, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByRankRangeOp creates a list get by rank range operation. Server selects list items starting at specified rank to the last ranked item and returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the list
- rank: Starting rank (0 = lowest, -1 = highest)
- returnType: What to return (see ListReturnType constants)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates getting items by rank range.
key, err := as.NewKey(*namespace, "test", "example-list-rank-range")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
lp := as.NewListPolicy(as.ListOrderOrdered, 0)
_, _ = client.Operate(nil, key, as.ListAppendWithPolicyOp(lp, "scores", 50, 10, 30, 20, 40))
record, err := client.Operate(nil, key, as.ListGetByRankRangeOp("scores", 0, as.ListReturnTypeValue))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["scores"])
Output: [10 20 30 40 50]
func ListGetByValueListOp ¶
func ListGetByValueListOp(binName string, values []any, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByValueListOp creates list get by value list operation. Server selects list items identified by values and returns selected data specified by returnType.
func ListGetByValueOp ¶
func ListGetByValueOp(binName string, value interface{}, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByValueOp creates a list get by value operation. Server selects list items identified by value and returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the list
- value: Value to search for
- returnType: What to return (see ListReturnType constants)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates finding indices of a value in a list.
key, err := as.NewKey(*namespace, "test", "example-list-get-by-value")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("items", "a", "b", "a", "c", "a"))
record, err := client.Operate(nil, key, as.ListGetByValueOp("items", "a", as.ListReturnTypeIndex))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["items"])
Output: [0 2 4]
func ListGetByValueRangeOp ¶
func ListGetByValueRangeOp(binName string, beginValue, endValue interface{}, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByValueRangeOp creates a list get by value range operation. Server selects list items identified by value range (valueBegin inclusive, valueEnd exclusive) If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin. Server returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the list
- beginValue: Start of value range (inclusive), nil for open-ended
- endValue: End of value range (exclusive), nil for open-ended
- returnType: What to return (see ListReturnType constants)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates getting list items in a value range.
key, err := as.NewKey(*namespace, "test", "example-list-value-range")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("prices", 5.0, 15.0, 25.0, 35.0, 45.0))
record, err := client.Operate(nil, key, as.ListGetByValueRangeOp("prices", 10.0, 40.0, as.ListReturnTypeValue))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["prices"])
Output: [15 25 35]
func ListGetByValueRelativeRankRangeCountOp ¶
func ListGetByValueRelativeRankRangeCountOp(binName string, value any, rank, count int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByValueRelativeRankRangeCountOp creates a list get by value relative to rank range operation. Server selects list items nearest to value and greater by relative rank with a count limit. Server returns selected data specified by returnType.
Examples for ordered list [0,4,5,9,11,15]:
(value,rank,count) = [selected items] (5,0,2) = [5,9] (5,1,1) = [9] (5,-1,2) = [4,5] (3,0,1) = [4] (3,3,7) = [11,15] (3,-3,2) = []
func ListGetByValueRelativeRankRangeOp ¶
func ListGetByValueRelativeRankRangeOp(binName string, value any, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListGetByValueRelativeRankRangeOp creates a list get by value relative to rank range operation. Server selects list items nearest to value and greater by relative rank. Server returns selected data specified by returnType.
Examples for ordered list [0,4,5,9,11,15]:
(value,rank) = [selected items] (5,0) = [5,9,11,15] (5,1) = [9,11,15] (5,-1) = [4,5,9,11,15] (3,0) = [4,5,9,11,15] (3,3) = [11,15] (3,-3) = [0,4,5,9,11,15]
func ListGetOp ¶
func ListGetOp(binName string, index int, ctx ...*CDTContext) *Operation
ListGetOp creates a list get operation. Server returns item at specified index in list bin.
Supports negative indexing: -1 = last item, -2 = second to last, etc.
Parameters:
- binName: Name of the bin containing the list
- index: List index (0 = first, -1 = last)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates getting an item at index from a list.
key, err := as.NewKey(*namespace, "test", "example-list-get")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("tasks", "first", "second", "last"))
record, err := client.Operate(nil, key,
as.ListGetOp("tasks", 0),
as.ListGetOp("tasks", -1),
)
if err != nil {
log.Fatal(err)
}
results := record.Bins["tasks"].(as.OpResults)
fmt.Println(results[0], results[1])
Output: first last
func ListGetRangeFromOp ¶
func ListGetRangeFromOp(binName string, index int, ctx ...*CDTContext) *Operation
ListGetRangeFromOp creates a list get range operation. Server returns items starting at specified index to the end of list.
func ListGetRangeOp ¶
func ListGetRangeOp(binName string, index int, count int, ctx ...*CDTContext) *Operation
ListGetRangeOp creates a list get range operation. Server returns "count" items starting at specified index in list bin.
Parameters:
- binName: Name of the bin containing the list
- index: Starting index (0 = first, -1 = last)
- count: Number of items to return
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates getting a range of items from a list.
key, err := as.NewKey(*namespace, "test", "example-list-get-range")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("scores", 10, 20, 30, 40, 50))
record, err := client.Operate(nil, key, as.ListGetRangeOp("scores", 1, 3))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["scores"])
Output: [20 30 40]
func ListIncrementByOneOp ¶
func ListIncrementByOneOp(binName string, index int, ctx ...*CDTContext) *Operation
ListIncrementByOneOp creates list increment operation with policy. Server increments list[index] by 1. Server returns list[index] after incrementing.
func ListIncrementByOneWithPolicyOp ¶
func ListIncrementByOneWithPolicyOp(policy *ListPolicy, binName string, index int, ctx ...*CDTContext) *Operation
ListIncrementByOneWithPolicyOp creates list increment operation with policy. Server increments list[index] by 1. Server returns list[index] after incrementing.
func ListIncrementOp ¶
func ListIncrementOp(binName string, index int, value any, ctx ...*CDTContext) *Operation
ListIncrementOp creates a list increment operation. Server increments list[index] by value. Value should be integer(IntegerValue, LongValue) or float(FloatValue). Server returns list[index] after incrementing.
func ListIncrementWithPolicyOp ¶
func ListIncrementWithPolicyOp(policy *ListPolicy, binName string, index int, value any, ctx ...*CDTContext) *Operation
ListIncrementWithPolicyOp creates a list increment operation. Server increments list[index] by value. Server returns list[index] after incrementing.
func ListInsertOp ¶
ListInsertOp creates a list insert operation. Server inserts value to specified index of list bin. Server returns list size on bin name. It will panic if no values have been passed.
Parameters:
- binName: Name of the bin containing the list
- index: Index position to insert at (0 = beginning, -1 = before last)
- values: One or more values to insert
Example ¶
Demonstrates inserting at a specific index.
key, err := as.NewKey(*namespace, "test", "example-list-insert")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("tasks", "a", "b", "c"))
record, err := client.Operate(nil, key,
as.ListInsertOp("tasks", 1, "inserted"),
as.GetBinOp("tasks"),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["tasks"].(as.OpResults)[1])
Output: [a inserted b c]
func ListInsertWithPolicyContextOp ¶
func ListInsertWithPolicyContextOp(policy *ListPolicy, binName string, index int, ctx []*CDTContext, values ...any) *Operation
ListInsertWithPolicyContextOp creates a list insert operation. Server inserts value to specified index of list bin. Server returns list size on bin name. It will panic is no values have been passed.
func ListInsertWithPolicyOp ¶
func ListInsertWithPolicyOp(policy *ListPolicy, binName string, index int, values ...any) *Operation
ListInsertWithPolicyOp creates a list insert operation. Server inserts value to specified index of list bin. Server returns list size on bin name. It will panic is no values have been passed.
func ListJoinBySeparatorOp ¶ added in v8.9.0
func ListJoinBySeparatorOp(binName string, separator string, ctx ...*CDTContext) *Operation
ListJoinBySeparatorOp creates a list join operation. Server concatenates the string items of the list bin, inserting `separator` between consecutive items, and returns the result. It is the inverse of the string `split` operation.
Parameters:
- binName: Name of the bin containing the list of strings
- separator: Substring placed between consecutive items
- ctx: Optional CDT context for nested lists
func ListJoinOp ¶ added in v8.9.0
func ListJoinOp(binName string, ctx ...*CDTContext) *Operation
ListJoinOp creates a list join operation. Server concatenates the string items of the list bin and returns the result.
Parameters:
- binName: Name of the bin containing the list of strings
- ctx: Optional CDT context for nested lists
func ListPopOp ¶
func ListPopOp(binName string, index int, ctx ...*CDTContext) *Operation
ListPopOp creates a list pop operation. Server returns item at specified index and removes item from list bin.
Parameters:
- binName: Name of the bin containing the list
- index: Index to pop from (0 = first, -1 = last)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates popping an item from a list (e.g. queue).
key, err := as.NewKey(*namespace, "test", "example-list-pop")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("queue", "first", "second", "third"))
record, err := client.Operate(nil, key,
as.ListPopOp("queue", 0),
as.GetBinOp("queue"),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["queue"].(as.OpResults)[0], record.Bins["queue"].(as.OpResults)[1])
Output: first [second third]
func ListPopRangeFromOp ¶
func ListPopRangeFromOp(binName string, index int, ctx ...*CDTContext) *Operation
ListPopRangeFromOp creates a list pop range operation. Server returns items starting at specified index to the end of list and removes items from list bin.
func ListPopRangeOp ¶
func ListPopRangeOp(binName string, index int, count int, ctx ...*CDTContext) *Operation
ListPopRangeOp creates a list pop range operation. Server returns items starting at specified index and removes items from list bin.
func ListRemoveByIndexOp ¶
func ListRemoveByIndexOp(binName string, index int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListRemoveByIndexOp creates a list remove operation. Server removes list item identified by index and returns removed data specified by returnType.
func ListRemoveByIndexRangeCountOp ¶
func ListRemoveByIndexRangeCountOp(binName string, index, count int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListRemoveByIndexRangeCountOp creates a list remove operation. Server removes "count" list items starting at specified index and returns removed data specified by returnType.
func ListRemoveByIndexRangeOp ¶
func ListRemoveByIndexRangeOp(binName string, index int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListRemoveByIndexRangeOp creates a list remove operation. Server removes list items starting at specified index to the end of list and returns removed data specified by returnType.
func ListRemoveByRankOp ¶
func ListRemoveByRankOp(binName string, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListRemoveByRankOp creates a list remove operation. Server removes list item identified by rank and returns removed data specified by returnType.
func ListRemoveByRankRangeCountOp ¶
func ListRemoveByRankRangeCountOp(binName string, rank int, count int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListRemoveByRankRangeCountOp creates a list remove operation. Server removes "count" list items starting at specified rank and returns removed data specified by returnType.
func ListRemoveByRankRangeOp ¶
func ListRemoveByRankRangeOp(binName string, rank int, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListRemoveByRankRangeOp creates a list remove operation. Server removes list items starting at specified rank to the last ranked item and returns removed data specified by returnType.
func ListRemoveByValueListOp ¶
func ListRemoveByValueListOp(binName string, values []any, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListRemoveByValueListOp creates list remove by value operation. Server removes list items identified by value and returns removed data specified by returnType.
func ListRemoveByValueOp ¶
func ListRemoveByValueOp(binName string, value interface{}, returnType ListReturnType, ctx ...*CDTContext) *Operation
ListRemoveByValueOp creates a list remove by value operation. Server removes the item identified by value and returns removed data specified by returnType.
Parameters:
- binName: Name of the bin containing the list
- value: Value to remove
- returnType: What to return (see ListReturnType constants)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates removing all occurrences of a value from a list.
key, err := as.NewKey(*namespace, "test", "example-list-remove-value")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("tasks", "done", "pending", "done"))
record, err := client.Operate(nil, key,
as.ListRemoveByValueOp("tasks", "done", as.ListReturnTypeCount),
as.GetBinOp("tasks"),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["tasks"].(as.OpResults)[0], record.Bins["tasks"].(as.OpResults)[1])
Output: 2 [pending]
func ListRemoveByValueRangeOp ¶
func ListRemoveByValueRangeOp(binName string, returnType ListReturnType, valueBegin, valueEnd any, ctx ...*CDTContext) *Operation
ListRemoveByValueRangeOp creates a list remove operation. Server removes list items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin. Server returns removed data specified by returnType
func ListRemoveByValueRelativeRankRangeCountOp ¶
func ListRemoveByValueRelativeRankRangeCountOp(binName string, returnType ListReturnType, value any, rank, count int, ctx ...*CDTContext) *Operation
ListRemoveByValueRelativeRankRangeCountOp creates a list remove by value relative to rank range operation. Server removes list items nearest to value and greater by relative rank with a count limit. Server returns removed data specified by returnType. Examples for ordered list [0,4,5,9,11,15]:
(value,rank,count) = [removed items] (5,0,2) = [5,9] (5,1,1) = [9] (5,-1,2) = [4,5] (3,0,1) = [4] (3,3,7) = [11,15] (3,-3,2) = []
func ListRemoveByValueRelativeRankRangeOp ¶
func ListRemoveByValueRelativeRankRangeOp(binName string, returnType ListReturnType, value any, rank int, ctx ...*CDTContext) *Operation
ListRemoveByValueRelativeRankRangeOp creates a list remove by value relative to rank range operation. Server removes list items nearest to value and greater by relative rank. Server returns removed data specified by returnType.
Examples for ordered list [0,4,5,9,11,15]:
(value,rank) = [removed items] (5,0) = [5,9,11,15] (5,1) = [9,11,15] (5,-1) = [4,5,9,11,15] (3,0) = [4,5,9,11,15] (3,3) = [11,15] (3,-3) = [0,4,5,9,11,15]
func ListRemoveOp ¶
func ListRemoveOp(binName string, index int, ctx ...*CDTContext) *Operation
ListRemoveOp creates a list remove operation. Server removes item at specified index from list bin. Server returns number of items removed.
Parameters:
- binName: Name of the bin containing the list
- index: Index to remove (0 = first, -1 = last)
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates removing an item at index from a list.
key, err := as.NewKey(*namespace, "test", "example-list-remove")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("tasks", "a", "b", "c"))
record, err := client.Operate(nil, key,
as.ListRemoveOp("tasks", 1),
as.GetBinOp("tasks"),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["tasks"].(as.OpResults)[1])
Output: [a c]
func ListRemoveRangeFromOp ¶
func ListRemoveRangeFromOp(binName string, index int, ctx ...*CDTContext) *Operation
ListRemoveRangeFromOp creates a list remove range operation. Server removes all items starting at specified index to the end of list. Server returns number of items removed.
func ListRemoveRangeOp ¶
func ListRemoveRangeOp(binName string, index int, count int, ctx ...*CDTContext) *Operation
ListRemoveRangeOp creates a list remove range operation. Server removes "count" items starting at specified index from list bin. Server returns number of items removed.
func ListSetOp ¶
func ListSetOp(binName string, index int, value interface{}, ctx ...*CDTContext) *Operation
ListSetOp creates a list set operation. Server sets item value at specified index in list bin. Server does not return a result by default.
Parameters:
- binName: Name of the bin containing the list
- index: Index to update (0 = first, -1 = last)
- value: New value to set
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates setting an item at index in a list.
key, err := as.NewKey(*namespace, "test", "example-list-set")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("items", "old1", "old2", "old3"))
_, err = client.Operate(nil, key,
as.ListSetOp("items", 1, "updated"),
as.GetBinOp("items"),
)
if err != nil {
log.Fatal(err)
}
rec, _ := client.Get(nil, key, "items")
fmt.Println(rec.Bins["items"])
Output: [old1 updated old3]
func ListSetOrderOp ¶
func ListSetOrderOp(binName string, listOrder ListOrderType, ctx ...*CDTContext) *Operation
ListSetOrderOp creates a set list order operation. Server sets list order. Server returns nil.
func ListSetOrderWithIndexOp ¶
func ListSetOrderWithIndexOp(binName string, listOrder ListOrderType, ctx ...*CDTContext) *Operation
ListSetOrderWithIndexOp creates a set list order operation with a persisted index. A list index improves lookup performance, but requires more storage. A list index can be created for a top-level ordered list only. Nested and unordered list indexes are not supported.
Server sets list order. Server returns nil.
func ListSetWithPolicyOp ¶
func ListSetWithPolicyOp(policy *ListPolicy, binName string, index int, value any, ctx ...*CDTContext) *Operation
ListSetWithPolicyOp creates a list set operation using a ListPolicy. Server sets item value at specified index in list bin. Server does not return a result by default.
func ListSizeOp ¶
func ListSizeOp(binName string, ctx ...*CDTContext) *Operation
ListSizeOp creates a list size operation. Server returns size of list on bin name.
Parameters:
- binName: Name of the bin containing the list
- ctx: Optional CDT context for nested lists
Example ¶
Demonstrates getting the size of a list bin.
key, err := as.NewKey(*namespace, "test", "example-list-size")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.ListAppendOp("tasks", "a", "b", "c", "d", "e"))
record, err := client.Operate(nil, key, as.ListSizeOp("tasks"))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["tasks"])
Output: 5
func ListSortOp ¶
func ListSortOp(binName string, sortFlags ListSortFlags, ctx ...*CDTContext) *Operation
ListSortOp creates list sort operation. Server sorts list according to sortFlags. Server does not return a result by default.
func ListTrimOp ¶
func ListTrimOp(binName string, index int, count int, ctx ...*CDTContext) *Operation
ListTrimOp creates a list trim operation. Server removes items in list bin that do not fall into range specified by index and count range. If the range is out of bounds, then all items will be removed. Server returns number of elements that were removed.
func MapClearOp ¶
func MapClearOp(binName string, ctx ...*CDTContext) *Operation
MapClearOp creates a map clear operation. Server removes all items in map. Server returns nil.
Parameters:
- binName: Name of the bin containing the map
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates clearing all items in a map bin.
key, err := as.NewKey(*namespace, "test", "example-map-clear")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(as.DefaultMapPolicy(), "profile", map[any]any{"a": 1, "b": 2}))
_, err = client.Operate(nil, key, as.MapClearOp("profile"))
if err != nil {
log.Fatal(err)
}
rec, _ := client.Get(nil, key, "profile")
fmt.Println(rec.Bins["profile"])
Output: map[]
func MapCreateOp ¶
func MapCreateOp(binName string, order mapOrderType, ctx []*CDTContext) *Operation
MapCreateOp creates a map create operation. Server creates map at given context level.
func MapCreateWithIndexOp ¶
MapCreateWithIndexOp creates a map create operation that persists its index. Server creates map at given context level. A map index improves lookup performance but requires more storage. A map index can be created for a top-level ordered map only. Nested and unordered map indexes are not supported.
func MapDecrementOp ¶
func MapDecrementOp(policy *MapPolicy, binName string, key any, decr any, ctx ...*CDTContext) *Operation
MapDecrementOp creates map decrement operation. Server decrements values by decr for all items identified by key and returns final result. Valid only for numbers.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map.
func MapGetByIndexOp ¶
func MapGetByIndexOp(binName string, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByIndexOp creates a map get by index operation. Server selects map item identified by index and returns selected data specified by returnType.
Index is the item offset from the start of the map (for ordered maps). Supports negative indexing: -1 = last item.
Parameters:
- binName: Name of the bin containing the map
- index: Index position (0 = first, -1 = last)
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates getting a map item by index.
key, err := as.NewKey(*namespace, "test", "example-map-get-by-index")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
policy := as.NewMapPolicy(as.MapOrder.KEY_ORDERED, as.MapWriteMode.UPDATE)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(policy, "leaderboard", map[any]any{"first": 100, "second": 90, "third": 80}))
record, err := client.Operate(nil, key, as.MapGetByIndexOp("leaderboard", 0, as.MapReturnType.KEY_VALUE))
if err != nil {
log.Fatal(err)
}
pairs := record.Bins["leaderboard"].([]as.MapPair)
pair := pairs[0]
fmt.Println(pair.Key, pair.Value)
Output: first 100
func MapGetByIndexRangeCountOp ¶
func MapGetByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByIndexRangeCountOp creates map get by index range operation. Server selects "count" map items starting at specified index and returns selected data specified by returnType.
func MapGetByIndexRangeOp ¶
func MapGetByIndexRangeOp(binName string, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByIndexRangeOp creates a map get by index range operation. Server selects map items starting at specified index to the end of map and returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the map
- index: Starting index (0 = first, -1 = last)
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates getting map items from an index to end.
key, err := as.NewKey(*namespace, "test", "example-map-index-range")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
policy := as.NewMapPolicy(as.MapOrder.KEY_ORDERED, as.MapWriteMode.UPDATE)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(policy, "items", map[any]any{"a": 1, "b": 2, "c": 3, "d": 4}))
record, err := client.Operate(nil, key, as.MapGetByIndexRangeOp("items", 1, as.MapReturnType.VALUE))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["items"])
Output: [2 3 4]
func MapGetByKeyListOp ¶
func MapGetByKeyListOp(binName string, keys []interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByKeyListOp creates a map get by key list operation. Server selects map items identified by keys and returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the map
- keys: List of keys to look up
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates getting multiple values by key list.
key, err := as.NewKey(*namespace, "test", "example-map-key-list")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
policy := as.NewMapPolicy(as.MapOrder.KEY_ORDERED, as.MapWriteMode.UPDATE)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(policy, "profile", map[any]any{"name": "Jane", "email": "j@x.com", "age": 25}))
keys := []any{"name", "email", "age"}
record, err := client.Operate(nil, key, as.MapGetByKeyListOp("profile", keys, as.MapReturnType.VALUE))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["profile"])
Output: [25 j@x.com Jane]
func MapGetByKeyOp ¶
func MapGetByKeyOp(binName string, key interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByKeyOp creates a map get by key operation. Server selects map item identified by key and returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the map
- key: The key to look up (string, int, or any supported type)
- returnType: What to return (see MapReturnType constants: VALUE, KEY, KEY_VALUE, EXISTS, etc.)
- ctx: Optional CDT context for nested maps
Returns an Operation that can be used with Client.Operate(). Note: Single operation returns value directly. OpResults (slice) is only returned when multiple operations target the same bin.
Example ¶
Demonstrates getting a value by key from a map.
key, err := as.NewKey(*namespace, "test", "example-map-get-by-key")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutOp(as.DefaultMapPolicy(), "profile", "email", "user@example.com"))
record, err := client.Operate(nil, key, as.MapGetByKeyOp("profile", "email", as.MapReturnType.VALUE))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["profile"])
Output: user@example.com
func MapGetByKeyRangeOp ¶
func MapGetByKeyRangeOp(binName string, keyBegin interface{}, keyEnd interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByKeyRangeOp creates a map get by key range operation. Server selects map items identified by key range (keyBegin inclusive, keyEnd exclusive). If keyBegin is nil, the range is less than keyEnd. If keyEnd is nil, the range is greater than equal to keyBegin.
Server returns selected data specified by returnType. Works best with ordered maps (KEY_ORDERED or KEY_VALUE_ORDERED).
Parameters:
- binName: Name of the bin containing the map
- keyBegin: Start of key range (inclusive), nil for open-ended
- keyEnd: End of key range (exclusive), nil for open-ended
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates getting map items by key range.
key, err := as.NewKey(*namespace, "test", "example-map-key-range")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
policy := as.NewMapPolicy(as.MapOrder.KEY_ORDERED, as.MapWriteMode.UPDATE)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(policy, "products", map[any]any{"A": 1, "B": 2, "C": 3, "D": 4}))
record, err := client.Operate(nil, key, as.MapGetByKeyRangeOp("products", "B", "D", as.MapReturnType.VALUE))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["products"])
Output: [2 3]
func MapGetByKeyRelativeIndexRangeCountOp ¶
func MapGetByKeyRelativeIndexRangeCountOp(binName string, key any, index, count int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByKeyRelativeIndexRangeCountOp creates a map get by key relative to index range operation. Server selects map items nearest to key and greater by index with a count limit. Server returns selected data specified by returnType (See MapReturnType).
Examples for ordered map [{0=17},{4=2},{5=15},{9=10}]:
(value,index,count) = [selected items]
(5,0,1) = [{5=15}]
(5,1,2) = [{9=10}]
(5,-1,1) = [{4=2}]
(3,2,1) = [{9=10}]
(3,-2,2) = [{0=17}]
func MapGetByKeyRelativeIndexRangeOp ¶
func MapGetByKeyRelativeIndexRangeOp(binName string, key any, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByKeyRelativeIndexRangeOp creates a map get by key relative to index range operation. Server selects map items nearest to key and greater by index. Server returns selected data specified by returnType.
Examples for ordered map [{0=17},{4=2},{5=15},{9=10}]:
(value,index) = [selected items]
(5,0) = [{5=15},{9=10}]
(5,1) = [{9=10}]
(5,-1) = [{4=2},{5=15},{9=10}]
(3,2) = [{9=10}]
(3,-2) = [{0=17},{4=2},{5=15},{9=10}]
func MapGetByRankOp ¶
func MapGetByRankOp(binName string, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByRankOp creates a map get by rank operation. Server selects map item identified by rank and returns selected data specified by returnType.
Rank is the sorted index of the value component:
- Rank 0: Item with lowest value
- Rank 1: Second lowest value
- Rank -1: Item with highest value (most common for leaderboards)
- Rank -2: Second highest value
Parameters:
- binName: Name of the bin containing the map
- rank: Rank position (0 = lowest, -1 = highest)
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates getting a map item by value rank.
key, err := as.NewKey(*namespace, "test", "example-map-get-by-rank")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(as.DefaultMapPolicy(), "scores", map[any]any{"alice": 50, "bob": 90, "carol": 70}))
record, err := client.Operate(nil, key, as.MapGetByRankOp("scores", -1, as.MapReturnType.KEY_VALUE))
if err != nil {
log.Fatal(err)
}
pair := record.Bins["scores"].([]as.MapPair)
fmt.Println(pair)
Output: [{bob 90}]
func MapGetByRankRangeCountOp ¶
func MapGetByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByRankRangeCountOp creates a map get by rank range operation with count limit. Server selects "count" map items starting at specified rank and returns selected data specified by returnType.
This is more intuitive than MapGetByRankRangeOp for getting top N items. Start from rank -1 (highest) and specify count to get the top N items.
Parameters:
- binName: Name of the bin containing the map
- rank: Starting rank (0 = lowest, -1 = highest)
- count: Number of items to return
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates getting the top N items by rank. Rank is determined by key, so the map must be KEY_ORDERED. Negative ranks count from the highest value (-1 is the highest). Results are returned in ascending rank order (lowest to highest).
key, err := as.NewKey(*namespace, "test", "example-map-rank-range-count")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
// KEY_ORDERED ensures rank is based on keys (leaderboard semantics).
policy := as.NewMapPolicy(as.MapOrder.KEY_ORDERED, as.MapWriteMode.UPDATE)
_, _ = client.Operate(nil, key,
as.MapPutOp(policy, "leaderboard", "a", 10),
as.MapPutOp(policy, "leaderboard", "b", 30),
as.MapPutOp(policy, "leaderboard", "c", 20),
as.MapPutOp(policy, "leaderboard", "d", 40),
)
// Get the top 2 values by rank.
record, err := client.Operate(nil, key,
as.MapGetByRankRangeCountOp(
"leaderboard",
-2, // start from second-highest value
2, // count
as.MapReturnType.KEY_VALUE,
),
)
if err != nil {
log.Fatal(err)
}
pairs := record.Bins["leaderboard"].([]as.MapPair)
fmt.Println(pairs)
Output: [{b 30} {d 40}]
func MapGetByRankRangeOp ¶
func MapGetByRankRangeOp(binName string, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByRankRangeOp creates map get by rank range operation. Server selects map items starting at specified rank to the last ranked item and returns selected data specified by returnType.
func MapGetByValueListOp ¶
func MapGetByValueListOp(binName string, values []any, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByValueListOp creates map get by value list operation. Server selects map items identified by values and returns selected data specified by returnType.
func MapGetByValueOp ¶
func MapGetByValueOp(binName string, value interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByValueOp creates a map get by value operation. Server selects map items identified by value and returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the map
- value: Value to search for
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates finding keys with a specific value.
key, err := as.NewKey(*namespace, "test", "example-map-get-by-value")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(as.DefaultMapPolicy(), "scores", map[any]any{"u1": 100, "u2": 80, "u3": 100}))
record, err := client.Operate(nil, key, as.MapGetByValueOp("scores", 100, as.MapReturnType.KEY))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["scores"])
Output: [u1 u3]
func MapGetByValueRangeOp ¶
func MapGetByValueRangeOp(binName string, valueBegin interface{}, valueEnd interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByValueRangeOp creates a map get by value range operation. Server selects map items identified by value range (valueBegin inclusive, valueEnd exclusive) If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin.
Server returns selected data specified by returnType.
Parameters:
- binName: Name of the bin containing the map
- valueBegin: Start of value range (inclusive), nil for open-ended
- valueEnd: End of value range (exclusive), nil for open-ended
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates getting map items by value range.
key, err := as.NewKey(*namespace, "test", "example-map-value-range")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(as.DefaultMapPolicy(), "products", map[any]any{"p1": 5.0, "p2": 15.0, "p3": 25.0, "p4": 35.0}))
record, err := client.Operate(nil, key, as.MapGetByValueRangeOp("products", 10.0, 30.0, as.MapReturnType.KEY_VALUE))
if err != nil {
log.Fatal(err)
}
fmt.Println(len(record.Bins["products"].([]as.MapPair)))
Output: 2
func MapGetByValueRelativeRankRangeCountOp ¶
func MapGetByValueRelativeRankRangeCountOp(binName string, value any, rank, count int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByValueRelativeRankRangeCountOp creates a map get by value relative to rank range operation. Server selects map items nearest to value and greater by relative rank with a count limit. Server returns selected data specified by returnType.
Examples for map [{4=2},{9=10},{5=15},{0=17}]:
(value,rank,count) = [selected items]
(11,1,1) = [{0=17}]
(11,-1,1) = [{9=10}]
func MapGetByValueRelativeRankRangeOp ¶
func MapGetByValueRelativeRankRangeOp(binName string, value any, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapGetByValueRelativeRankRangeOp creates a map get by value relative to rank range operation. Server selects map items nearest to value and greater by relative rank. Server returns selected data specified by returnType.
Examples for map [{4=2},{9=10},{5=15},{0=17}]:
(value,rank) = [selected items]
(11,1) = [{0=17}]
(11,-1) = [{9=10},{5=15},{0=17}]
func MapIncrementOp ¶
func MapIncrementOp(policy *MapPolicy, binName string, key interface{}, incr interface{}, ctx ...*CDTContext) *Operation
MapIncrementOp creates map increment operation. Server increments values by incr for all items identified by key and returns final result. Valid only for numbers.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map.
Parameters:
- policy: Map policy
- binName: Name of the bin containing the map
- key: Map key to increment
- incr: Increment value (must be numeric)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates incrementing a map value.
key, err := as.NewKey(*namespace, "test", "example-map-increment")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutOp(as.DefaultMapPolicy(), "counters", "views", 0))
record, err := client.Operate(nil, key,
as.MapIncrementOp(as.DefaultMapPolicy(), "counters", "views", 5),
as.MapIncrementOp(as.DefaultMapPolicy(), "counters", "views", 3),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["counters"].(as.OpResults)[1])
Output: 8
func MapPutItemsOp ¶
func MapPutItemsOp(policy *MapPolicy, binName string, amap map[interface{}]interface{}, ctx ...*CDTContext) *Operation
MapPutItemsOp creates a map put items operation. Server writes each map item to map bin and returns map size.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map.
Parameters:
- policy: Map policy (use DefaultMapPolicy() or NewMapPolicy())
- binName: Name of the bin containing the map
- amap: Map of key-value pairs to put
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates putting multiple map items at once.
key, err := as.NewKey(*namespace, "test", "example-map-put-items")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
items := map[any]any{
"name": "John Doe",
"email": "john@example.com",
"age": 30,
}
_, err = client.Operate(nil, key,
as.MapPutItemsOp(as.DefaultMapPolicy(), "profile", items),
as.GetBinOp("profile"),
)
if err != nil {
log.Fatal(err)
}
rec, _ := client.Get(nil, key, "profile")
p := rec.Bins["profile"].(map[any]any)
fmt.Println(p["name"], p["age"])
Output: John Doe 30
func MapPutOp ¶
func MapPutOp(policy *MapPolicy, binName string, key interface{}, value interface{}, ctx ...*CDTContext) *Operation
MapPutOp creates a map put operation. Server writes key/value item to map bin and returns map size.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map.
Parameters:
- policy: Map policy (use DefaultMapPolicy() or NewMapPolicy())
- binName: Name of the bin containing the map
- key: Map key
- value: Map value
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates putting a key-value pair, including into a nested map using context.
key, err := as.NewKey(*namespace, "test", "example-map-put")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
// Simple put
_, err = client.Operate(nil, key,
as.MapPutOp(as.DefaultMapPolicy(), "profile", "email", "user@example.com"),
)
if err != nil {
log.Fatal(err)
}
// Nested put: user.address.city = "San Francisco"
// The nested map at "address" must exist before putting into it. Create user with name and empty address map.
_ = client.Put(nil, key, as.BinMap{"user": map[any]any{"name": "Alice", "address": map[any]any{}}})
ctx := []*as.CDTContext{as.CtxMapKey(as.StringValue("address"))}
_, err = client.Operate(nil, key,
as.MapPutOp(as.DefaultMapPolicy(), "user", "city", "San Francisco", ctx...),
as.GetBinOp("user"),
)
if err != nil {
log.Fatal(err)
}
rec, _ := client.Get(nil, key, "user")
u := rec.Bins["user"].(map[any]any)
addr := u["address"].(map[any]any)
fmt.Println(addr["city"])
Output: San Francisco
func MapRemoveByIndexOp ¶
func MapRemoveByIndexOp(binName string, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByIndexOp creates map remove operation. Server removes map item identified by index and returns removed data specified by returnType.
func MapRemoveByIndexRangeCountOp ¶
func MapRemoveByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByIndexRangeCountOp creates map remove operation. Server removes "count" map items starting at specified index and returns removed data specified by returnType.
func MapRemoveByIndexRangeOp ¶
func MapRemoveByIndexRangeOp(binName string, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByIndexRangeOp creates map remove operation. Server removes map items starting at specified index to the end of map and returns removed data specified by returnType.
func MapRemoveByKeyListOp ¶
func MapRemoveByKeyListOp(binName string, keys []any, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByKeyListOp creates map remove operation. Server removes map items identified by keys and returns removed data specified by returnType.
func MapRemoveByKeyOp ¶
func MapRemoveByKeyOp(binName string, key interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByKeyOp creates a map remove by key operation. Server removes map item identified by key and returns removed data specified by returnType.
Parameters:
- binName: Name of the bin containing the map
- key: Key to remove
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates removing a key from a map.
key, err := as.NewKey(*namespace, "test", "example-map-remove-key")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(as.DefaultMapPolicy(), "profile", map[any]any{"name": "Alice", "temp": "x", "age": 30}))
record, err := client.Operate(nil, key,
as.MapRemoveByKeyOp("profile", "temp", as.MapReturnType.VALUE),
as.GetBinOp("profile"),
)
if err != nil {
log.Fatal(err)
}
removed := record.Bins["profile"].(as.OpResults)[0]
remaining := record.Bins["profile"].(as.OpResults)[1].(map[any]any)
fmt.Println(removed, len(remaining))
Output: x 2
func MapRemoveByKeyRangeOp ¶
func MapRemoveByKeyRangeOp(binName string, keyBegin any, keyEnd any, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByKeyRangeOp creates map remove operation. Server removes map items identified by key range (keyBegin inclusive, keyEnd exclusive). If keyBegin is nil, the range is less than keyEnd. If keyEnd is nil, the range is greater than equal to keyBegin.
Server returns removed data specified by returnType.
func MapRemoveByKeyRelativeIndexRangeCountOp ¶
func MapRemoveByKeyRelativeIndexRangeCountOp(binName string, key any, index, count int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByKeyRelativeIndexRangeCountOp creates map remove by key relative to index range operation. Server removes map items nearest to key and greater by index with a count limit. Server returns removed data specified by returnType.
Examples for map [{0=17},{4=2},{5=15},{9=10}]:
(value,index,count) = [removed items]
(5,0,1) = [{5=15}]
(5,1,2) = [{9=10}]
(5,-1,1) = [{4=2}]
(3,2,1) = [{9=10}]
(3,-2,2) = [{0=17}]
func MapRemoveByKeyRelativeIndexRangeOp ¶
func MapRemoveByKeyRelativeIndexRangeOp(binName string, key any, index int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByKeyRelativeIndexRangeOp creates a map remove by key relative to index range operation. Server removes map items nearest to key and greater by index. Server returns removed data specified by returnType.
Examples for map [{0=17},{4=2},{5=15},{9=10}]:
(value,index) = [removed items]
(5,0) = [{5=15},{9=10}]
(5,1) = [{9=10}]
(5,-1) = [{4=2},{5=15},{9=10}]
(3,2) = [{9=10}]
(3,-2) = [{0=17},{4=2},{5=15},{9=10}]
func MapRemoveByRankOp ¶
func MapRemoveByRankOp(binName string, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByRankOp creates map remove operation. Server removes map item identified by rank and returns removed data specified by returnType.
func MapRemoveByRankRangeCountOp ¶
func MapRemoveByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByRankRangeCountOp creates map remove operation. Server removes "count" map items starting at specified rank and returns removed data specified by returnType.
func MapRemoveByRankRangeOp ¶
func MapRemoveByRankRangeOp(binName string, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByRankRangeOp creates map remove operation. Server removes map items starting at specified rank to the last ranked item and returns removed data specified by returnType.
func MapRemoveByValueListOp ¶
func MapRemoveByValueListOp(binName string, values []any, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByValueListOp creates map remove operation. Server removes map items identified by values and returns removed data specified by returnType.
func MapRemoveByValueOp ¶
func MapRemoveByValueOp(binName string, value interface{}, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByValueOp creates a map remove by value operation. Server removes map items identified by value and returns removed data specified by returnType.
Parameters:
- binName: Name of the bin containing the map
- value: Value to match for removal
- returnType: What to return (see MapReturnType constants)
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates removing map items by value.
key, err := as.NewKey(*namespace, "test", "example-map-remove-value")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(as.DefaultMapPolicy(), "status", map[any]any{"u1": "active", "u2": "inactive", "u3": "active"}))
record, err := client.Operate(nil, key,
as.MapRemoveByValueOp("status", "inactive", as.MapReturnType.KEY),
as.GetBinOp("status"),
)
if err != nil {
log.Fatal(err)
}
removed := record.Bins["status"].(as.OpResults)[0]
remaining := record.Bins["status"].(as.OpResults)[1].(map[any]any)
fmt.Println(removed, len(remaining))
Output: [u2] 2
func MapRemoveByValueRangeOp ¶
func MapRemoveByValueRangeOp(binName string, valueBegin any, valueEnd any, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByValueRangeOp creates map remove operation. Server removes map items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin.
Server returns removed data specified by returnType.
func MapRemoveByValueRelativeRankRangeCountOp ¶
func MapRemoveByValueRelativeRankRangeCountOp(binName string, value any, rank, count int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByValueRelativeRankRangeCountOp creates a map remove by value relative to rank range operation. Server removes map items nearest to value and greater by relative rank with a count limit. Server returns removed data specified by returnType (See MapReturnType).
Examples for map [{4=2},{9=10},{5=15},{0=17}]:
(value,rank,count) = [removed items]
(11,1,1) = [{0=17}]
(11,-1,1) = [{9=10}]
func MapRemoveByValueRelativeRankRangeOp ¶
func MapRemoveByValueRelativeRankRangeOp(binName string, value any, rank int, returnType mapReturnType, ctx ...*CDTContext) *Operation
MapRemoveByValueRelativeRankRangeOp creates a map remove by value relative to rank range operation. Server removes map items nearest to value and greater by relative rank. Server returns removed data specified by returnType.
Examples for map [{4=2},{9=10},{5=15},{0=17}]:
(value,rank) = [removed items]
(11,1) = [{0=17}]
(11,-1) = [{9=10},{5=15},{0=17}]
func MapSetPolicyOp ¶
func MapSetPolicyOp(policy *MapPolicy, binName string, ctx ...*CDTContext) *Operation
MapSetPolicyOp creates set map policy operation. Server sets map policy attributes. Server returns nil.
The required map policy attributes can be changed after the map is created.
func MapSizeOp ¶
func MapSizeOp(binName string, ctx ...*CDTContext) *Operation
MapSizeOp creates a map size operation. Server returns size of map.
Parameters:
- binName: Name of the bin containing the map
- ctx: Optional CDT context for nested maps
Example ¶
Demonstrates getting the size of a map bin.
key, err := as.NewKey(*namespace, "test", "example-map-size")
if err != nil {
log.Fatal(err)
}
client.Delete(nil, key)
_, _ = client.Operate(nil, key, as.MapPutItemsOp(as.DefaultMapPolicy(), "profile", map[any]any{"a": 1, "b": 2, "c": 3}))
record, err := client.Operate(nil, key, as.MapSizeOp("profile"))
if err != nil {
log.Fatal(err)
}
fmt.Println(record.Bins["profile"])
Output: 3
func ModifyByPath ¶ added in v8.6.0
func ModifyByPath(binName string, flag ModifyFlag, modifyExp *Expression, ctx ...*CDTContext) *Operation
ModifyByPath creates CDT apply operation with context and modify expression. Equivalent to as_operations_cdt_apply in C client.
Parameters:
- binName: bin name
- flags: select flags
- modifyExp: modify expression
- ctx: optional path to nested CDT. If not defined, the top-level CDT is used.
Returns nil if ctx is nil.
func PrependOp
deprecated
PrependOp creates string prepend database operation.
Deprecated: PrepndOp has been deprecated since 8.8.0. Use StrPrependOp instead. This legacy operation performs a raw byte concatenation that is not Unicode/DBCS-aware; the string-package equivalent provides consistent Unicode handling and policy/CTX support. Deprecated since version 8.8.0.
func SelectByPath ¶ added in v8.6.0
func SelectByPath(binName string, flag SelectFlag, ctx ...*CDTContext) *Operation
SelectByPath creates CDT select operation with context. Equivalent to as_operations_cdt_select in C client.
Parameters:
- binName: bin name
- flags: select flags
- ctx: optional path to nested CDT. If not defined, the top-level CDT is used.
Returns nil if ctx is nil.
func StrAppendOp ¶ added in v8.9.0
func StrAppendOp(policy *StringPolicy, binName string, value string, ctx ...*CDTContext) *Operation
StrAppendOp creates a string `append` operation that appends `value` to the end of the bin. Unlike the legacy byte-level AppendOp, this operation is Unicode/DBCS-aware and shares the consistent StringPolicy / CTX interface of the rest of the string package.
func StrB64DecodeOp ¶ added in v8.9.0
func StrB64DecodeOp(binName string, ctx ...*CDTContext) *Operation
StrB64DecodeOp creates a string `b64Decode` operation. The server treats the bin as base64-encoded text and returns the decoded bytes as a blob. A bin that is not valid base64 fails with types.OP_NOT_APPLICABLE, subcode types.SubCodeOpNotStringB64Invalid.
func StrByteLengthOp ¶ added in v8.9.0
func StrByteLengthOp(binName string, ctx ...*CDTContext) *Operation
StrByteLengthOp creates a string `byteLength` operation. The server returns the number of UTF-8 bytes in the string (int64). Differs from StrLenOp for non-ASCII content where one codepoint can encode to multiple bytes.
func StrCaseFoldOp ¶ added in v8.9.0
func StrCaseFoldOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
StrCaseFoldOp creates a string `caseFold` operation that applies a locale-independent case fold (lowercase) to the bin. Useful for normalized comparison keys.
func StrCharAtOp ¶ added in v8.9.0
func StrCharAtOp(binName string, index int, ctx ...*CDTContext) *Operation
StrCharAtOp creates a string `charAt` operation. The server returns the codepoint at `index` as a one-codepoint string. Negative indexes count from the end.
func StrConcatListOp ¶ added in v8.9.0
func StrConcatListOp(policy *StringPolicy, binName string, values []string, ctx ...*CDTContext) *Operation
StrConcatListOp creates a string `concat` operation that appends each element of `values` to the bin in order.
func StrConcatOp ¶ added in v8.9.0
func StrConcatOp(policy *StringPolicy, binName string, value string, ctx ...*CDTContext) *Operation
StrConcatOp creates a string `concat` operation that appends `value` to the bin.
func StrContainsOp ¶ added in v8.9.0
func StrContainsOp(binName string, needle string, ctx ...*CDTContext) *Operation
StrContainsOp creates a string `contains` operation. The server returns true if the bin contains `needle` as a substring, false otherwise.
func StrEndsWithOp ¶ added in v8.9.0
func StrEndsWithOp(binName string, suffix string, ctx ...*CDTContext) *Operation
StrEndsWithOp creates a string `endsWith` operation. The server returns true if the bin ends with `suffix`, false otherwise. Matching is Unicode canonical, not byte-exact: a suffix stored in a different normalization form than the bin still matches.
func StrFindNthOp ¶ added in v8.9.0
func StrFindNthOp(binName string, needle string, occurrence int, ctx ...*CDTContext) *Operation
StrFindNthOp creates a string `find` operation that locates a specific `occurrence` of `needle` (1 = first match, -1 = last match). The server returns the codepoint index of that match, or -1 if not found.
func StrFindOp ¶ added in v8.9.0
func StrFindOp(binName string, needle string, ctx ...*CDTContext) *Operation
StrFindOp creates a string `find` operation. The server returns the codepoint index of the first occurrence of `needle`, or -1 if not found.
func StrInsertOp ¶ added in v8.9.0
func StrInsertOp(policy *StringPolicy, binName string, index int, value string, ctx ...*CDTContext) *Operation
StrInsertOp creates a string `insert` operation that splices `value` into the bin at codepoint `index`. Negative indexes count from the end of the string.
func StrIsLowerOp ¶ added in v8.9.0
func StrIsLowerOp(binName string, ctx ...*CDTContext) *Operation
StrIsLowerOp creates a string `isLower` operation. The server returns true if every cased codepoint in the bin is lowercase, false otherwise.
func StrIsNumericOp ¶ added in v8.9.0
func StrIsNumericOp(binName string, ctx ...*CDTContext) *Operation
StrIsNumericOp creates a string `isNumeric` operation. The server returns true if the bin contains a valid integer or float, false otherwise.
func StrIsNumericTypedOp ¶ added in v8.9.0
func StrIsNumericTypedOp(binName string, numericType StringNumericType, ctx ...*CDTContext) *Operation
StrIsNumericTypedOp creates a string `isNumeric` operation that filters by `numericType` (see StringNumericType). For example, restrict to integer-only or float-only validation.
func StrIsUpperOp ¶ added in v8.9.0
func StrIsUpperOp(binName string, ctx ...*CDTContext) *Operation
StrIsUpperOp creates a string `isUpper` operation. The server returns true if every cased codepoint in the bin is uppercase, false otherwise.
func StrLenOp ¶ added in v8.9.0
func StrLenOp(binName string, ctx ...*CDTContext) *Operation
StrLenOp creates a string `strlen` operation. The server returns the number of Unicode codepoints in the string bin as an int64. This is the codepoint count — not the grapheme cluster count and not the UTF-8 byte length. Use StrByteLengthOp for the byte length.
func StrLowerOp ¶ added in v8.9.0
func StrLowerOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
StrLowerOp creates a string `lower` operation that lowercases the bin in place.
func StrNormalizeNFCOp ¶ added in v8.9.0
func StrNormalizeNFCOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
StrNormalizeNFCOp creates a string `normalizeNFC` operation that normalizes the bin to Unicode NFC form. Already-normalized strings are unchanged.
func StrOverwriteOp ¶ added in v8.9.0
func StrOverwriteOp(policy *StringPolicy, binName string, index int, value string, ctx ...*CDTContext) *Operation
StrOverwriteOp creates a string `overwrite` operation that overwrites codepoints starting at codepoint `index` with `value`. The result may grow beyond the original length when `value` extends past the end.
func StrPadEndOp ¶ added in v8.9.0
func StrPadEndOp(policy *StringPolicy, binName string, targetLength int, padString string, ctx ...*CDTContext) *Operation
StrPadEndOp creates a string `padEnd` operation that appends `padString` repeatedly until the bin reaches `targetLength` codepoints. No-op when the bin is already at or above the target length.
func StrPadStartOp ¶ added in v8.9.0
func StrPadStartOp(policy *StringPolicy, binName string, targetLength int, padString string, ctx ...*CDTContext) *Operation
StrPadStartOp creates a string `padStart` operation that prepends `padString` repeatedly until the bin reaches `targetLength` codepoints. No-op when the bin is already at or above the target length.
func StrPrependOp ¶ added in v8.9.0
func StrPrependOp(policy *StringPolicy, binName string, value string, ctx ...*CDTContext) *Operation
StrPrependOp creates a string `prepend` operation that prepends `value` to the start of the bin. Unlike the legacy byte-level PrependOp, this operation is Unicode/DBCS-aware and shares the consistent StringPolicy / CTX interface of the rest of the string package.
func StrRegexCompareOp ¶ added in v8.9.0
func StrRegexCompareOp(binName string, pattern string, ctx ...*CDTContext) *Operation
StrRegexCompareOp creates a string `regexCompare` operation. The server matches `pattern` (ICU regex syntax) against the bin and returns true on match, false otherwise.
func StrRegexCompareWithFlagsOp ¶ added in v8.9.0
func StrRegexCompareWithFlagsOp(binName string, pattern string, regexFlags StringRegexFlags, ctx ...*CDTContext) *Operation
StrRegexCompareWithFlagsOp creates a string `regexCompare` operation that honors StringRegexFlags (e.g. StringRegexCaseInsensitive). Flag values may be combined with bitwise OR.
func StrRegexReplaceOp ¶ added in v8.9.0
func StrRegexReplaceOp(policy *StringPolicy, binName string, pattern string, replacement string, regexFlags StringRegexFlags, ctx ...*CDTContext) *Operation
StrRegexReplaceOp creates a string `regexReplace` operation that replaces the first match of `pattern` with `replacement`. Pass StringRegexGlobal to replace every match. Flag values from StringRegexFlags may be combined with bitwise OR.
The StringWriteDefault, StringWriteUpdateOnly and StringWriteNoFail write flags apply to this op; StringWriteCreateOnly is rejected by the server. StringWriteNoFail also suppresses a regex-compile failure.
func StrRepeatOp ¶ added in v8.9.0
func StrRepeatOp(policy *StringPolicy, binName string, count int, ctx ...*CDTContext) *Operation
StrRepeatOp creates a string `repeat` operation that repeats the bin contents `count` times. `count` must be non-negative.
func StrReplaceAllOp ¶ added in v8.9.0
func StrReplaceAllOp(policy *StringPolicy, binName string, needle string, replacement string, ctx ...*CDTContext) *Operation
StrReplaceAllOp creates a string `replaceAll` operation that replaces every occurrence of `needle` with `replacement`.
func StrReplaceOp ¶ added in v8.9.0
func StrReplaceOp(policy *StringPolicy, binName string, needle string, replacement string, ctx ...*CDTContext) *Operation
StrReplaceOp creates a string `replace` operation that replaces the first occurrence of `needle` with `replacement`.
func StrSnipFromOp ¶ added in v8.9.0
func StrSnipFromOp(policy *StringPolicy, binName string, start int, ctx ...*CDTContext) *Operation
StrSnipFromOp creates a string `snip` operation that removes codepoints starting at codepoint `start` through the end of the string, truncating the bin. `snip("hello world", 5)` leaves `"hello"`.
The server's snip argument list is positional — start, end, flags — so the one-argument form cannot carry `policy` flags without also supplying an explicit `end`. `policy` is accepted for signature parity with the rest of the modify ops; use StrSnipOp when the write flags must be honored.
func StrSnipOp ¶ added in v8.9.0
func StrSnipOp(policy *StringPolicy, binName string, start int, end int, ctx ...*CDTContext) *Operation
StrSnipOp creates a string `snip` operation that removes the half-open codepoint range [start, end) from the bin.
func StrSplitBySeparatorOp ¶ added in v8.9.0
func StrSplitBySeparatorOp(binName string, separator string, ctx ...*CDTContext) *Operation
StrSplitBySeparatorOp creates a string `split` operation that splits the bin by the `separator` substring. If the separator is absent the result is a singleton list containing the whole string.
func StrSplitOp ¶ added in v8.9.0
func StrSplitOp(binName string, ctx ...*CDTContext) *Operation
StrSplitOp creates a string `split` operation that splits by Unicode codepoint — each codepoint becomes its own element of the returned list.
func StrStartsWithOp ¶ added in v8.9.0
func StrStartsWithOp(binName string, prefix string, ctx ...*CDTContext) *Operation
StrStartsWithOp creates a string `startsWith` operation. The server returns true if the bin begins with `prefix`, false otherwise. Matching is Unicode canonical, not byte-exact: a prefix stored in a different normalization form than the bin still matches.
func StrSubstrFromOp ¶ added in v8.9.0
func StrSubstrFromOp(binName string, start int, ctx ...*CDTContext) *Operation
StrSubstrFromOp creates a string `substr` operation that reads from `start` to the end of the string. Negative `start` counts from the end.
func StrSubstrOp ¶ added in v8.9.0
func StrSubstrOp(binName string, start int, end int, ctx ...*CDTContext) *Operation
StrSubstrOp creates a string `substr` operation that reads codepoints in the half-open range `[start, end)`. Negative indexes count from the end. `end` is clamped to the string length.
func StrToBlobOp ¶ added in v8.9.0
func StrToBlobOp(binName string, ctx ...*CDTContext) *Operation
StrToBlobOp creates a string `toBlob` operation. The server returns the UTF-8 bytes of the string as a blob ([]byte).
func StrToDoubleOp ¶ added in v8.9.0
func StrToDoubleOp(binName string, ctx ...*CDTContext) *Operation
StrToDoubleOp creates a string `toDouble` operation. The server parses the string as a 64-bit float. A bin that cannot be parsed as a double fails with types.OP_NOT_APPLICABLE, subcode types.SubCodeOpNotStringConversionFailed.
func StrToIntegerOp ¶ added in v8.9.0
func StrToIntegerOp(binName string, ctx ...*CDTContext) *Operation
StrToIntegerOp creates a string `toInteger` operation. The server parses the string as an int64. A bin that cannot be parsed as an integer fails with types.OP_NOT_APPLICABLE, subcode types.SubCodeOpNotStringConversionFailed.
func StrToStringOp ¶ added in v8.9.0
StrToStringOp creates a `toString` operation that converts an integer, float, bool, string, or blob bin to its string representation. Returns AEROSPIKE_ERR_INCOMPATIBLE_TYPE for any other bin type. A blob bin that is not valid UTF-8 fails with types.OP_NOT_APPLICABLE, subcode types.SubCodeOpNotStringUTF8Invalid.
Unlike the other builders in this file, StrToStringOp does not accept a CDTContext. The other string operations are sent as STRING_READ / STRING_MODIFY wire ops carrying a msgpack payload (with the optional CTX envelope). StrToStringOp is a separate top-level wire op (TO_STRING, code 19) that carries no payload at all — the bin is referenced solely by the operation header — and the server-side handler for it never inspects an op payload.
To convert a value nested inside a list or map, extract the leaf with ListGetByIndexOp or MapGetByKeyOp (using the appropriate CDTContext) and convert it client-side.
func StrTrimEndOp ¶ added in v8.9.0
func StrTrimEndOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
StrTrimEndOp creates a string `trimEnd` operation that removes whitespace from the end of the bin.
func StrTrimOp ¶ added in v8.9.0
func StrTrimOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
StrTrimOp creates a string `trim` operation that removes whitespace from both ends of the bin.
func StrTrimStartOp ¶ added in v8.9.0
func StrTrimStartOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
StrTrimStartOp creates a string `trimStart` operation that removes whitespace from the start of the bin.
func StrUpperOp ¶ added in v8.9.0
func StrUpperOp(policy *StringPolicy, binName string, ctx ...*CDTContext) *Operation
StrUpperOp creates a string `upper` operation that uppercases the bin in place.
type OperationType ¶
type OperationType struct {
// contains filtered or unexported fields
}
OperationType determines operation type
type Partition ¶
type Partition struct {
// Namespace of the partition
Namespace string
// PartitionId of the partition
PartitionId int
// contains filtered or unexported fields
}
Partition encapsulates partition information.
func NewPartition ¶
func NewPartition(partitions *Partitions, key *Key, replica ReplicaPolicy, prevNode *Node, linearize bool) *Partition
NewPartition returns a partition representation
func NewPartitionForReplicaPolicy ¶
func NewPartitionForReplicaPolicy(namespace string, replica ReplicaPolicy) *Partition
NewPartitionForReplicaPolicy returns a partition for the stated replica policy
func (*Partition) GetNodeQuery ¶
func (ptn *Partition) GetNodeQuery(cluster *Cluster, partitions *Partitions, ps *PartitionStatus) (*Node, Error)
func (*Partition) GetNodeRead ¶
GetNodeRead returns a node for read operations
func (*Partition) GetNodeWrite ¶
GetNodeWrite returns a node for write operations
func (*Partition) PrepareRetryRead ¶
PrepareRetryRead increases sequence number before read retries
func (*Partition) PrepareRetryWrite ¶
PrepareRetryWrite increases sequence number before write retries
type PartitionFilter ¶
type PartitionFilter struct {
Begin int
Count int
Digest []byte
// Partitions encapsulates the cursor for the progress of the scan/query to be used for pagination.
Partitions []*PartitionStatus
Done bool
Retry bool
}
PartitionFilter is used in scan/queries. This filter is also used as a cursor.
If a previous scan/query returned all records specified by a PartitionFilter instance, a future scan/query using the same PartitionFilter instance will only return new records added after the last record read (in digest order) in each partition in the previous scan/query.
func NewPartitionFilterAll ¶
func NewPartitionFilterAll() *PartitionFilter
NewPartitionFilterAll creates a partition filter that reads all the partitions.
func NewPartitionFilterById ¶
func NewPartitionFilterById(partitionId int) *PartitionFilter
NewPartitionFilterById creates a partition filter by partition id. Partition id is between 0 - 4095
func NewPartitionFilterByKey ¶
func NewPartitionFilterByKey(key *Key) *PartitionFilter
NewPartitionFilterByKey returns records after the key's digest in the partition containing the digest. Records in all other partitions are not included. The digest is used to determine order and this is not the same as userKey order.
This method only works for scan or query with nil filter (primary index query). This method does not work for a secondary index query because the digest alone is not sufficient to determine a cursor in a secondary index query.
func NewPartitionFilterByRange ¶
func NewPartitionFilterByRange(begin, count int) *PartitionFilter
NewPartitionFilterByRange creates a partition filter by partition range. begin partition id is between 0 - 4095 count is the number of partitions, in the range of 1 - 4096 inclusive.
func NewPartitionFilterSelectPartitions ¶ added in v8.3.0
func NewPartitionFilterSelectPartitions(partitionIds []int) (*PartitionFilter, error)
func (*PartitionFilter) DecodeCursor ¶
func (pf *PartitionFilter) DecodeCursor(b []byte) Error
Decodes and sets the cursor for the partition filter using the output of PartitionFilter.EncodeCursor.
func (*PartitionFilter) EncodeCursor ¶
func (pf *PartitionFilter) EncodeCursor() ([]byte, Error)
EncodeCursor encodes and returns the cursor for the partition filter. This cursor can be persisted and reused later for pagination via PartitionFilter.DecodeCursor.
Example ¶
// Setup the client here
// client, err := as.NewClient("127.0.0.1", 3000)
// if err != nil {
// log.Fatal(err)
// }
var ns = *namespace
var set = randString(50)
// initialize the records
keyCount := 1000
for i := 0; i < keyCount; i++ {
key, err := as.NewKey(ns, set, i)
if err != nil {
log.Fatal(err)
}
err = client.Put(nil, key, as.BinMap{"bin": i})
if err != nil {
log.Fatal(err)
}
}
// Set up the scan policy
spolicy := as.NewScanPolicy()
spolicy.MaxRecords = 30
received := 0
var buf []byte
for received < keyCount {
pf := as.NewPartitionFilterAll()
if len(buf) > 0 {
err = pf.DecodeCursor(buf)
if err != nil {
log.Fatal(err)
}
}
recordset, err := client.ScanPartitions(spolicy, pf, ns, set)
if err != nil {
log.Fatal(err)
}
counter := 0
for range recordset.Results() {
counter++
received++
}
if counter > 30 {
log.Fatal("More records received than requested.")
}
buf, err = pf.EncodeCursor()
if err != nil {
log.Fatal(err)
}
}
fmt.Println(received)
Output: 1000
func (*PartitionFilter) IsDone ¶
func (pf *PartitionFilter) IsDone() bool
IsDone returns - if using ScanPolicy.MaxRecords or QueryPolicy,MaxRecords - if the previous paginated scans with this partition filter instance return all records? This method is not synchronized and is not meant to be called while the Scan/Query is ongoing. It should be called after all the records are received from the recordset.
type PartitionStatus ¶
type PartitionStatus struct {
// BVal
BVal int64
// Id shows the partition Id.
Id int
// Retry signifies if the partition requires a retry.
Retry bool
// Digest records the digest of the last key digest received from the server
// for this partition.
Digest []byte
// contains filtered or unexported fields
}
PartitionStatus encapsulates the pagination status in partitions.
func (*PartitionStatus) String ¶
func (ps *PartitionStatus) String() string
type Partitions ¶
Partitions represents a list of partitions
type Policy ¶
type Policy interface {
// Retrieves BasePolicy
GetBasePolicy() *BasePolicy
// contains filtered or unexported methods
}
Policy Interface
type Privilege ¶
type Privilege struct {
// Role
Code privilegeCode
// Namespace determines namespace scope. Apply permission to this namespace only.
// If namespace is zero value, the privilege applies to all namespaces.
Namespace string
// Set name scope. Apply permission to this set within namespace only.
// If set is zero value, the privilege applies to all sets within namespace.
SetName string
}
Privilege determines user access granularity.
type QueryDuration ¶
type QueryDuration int
QueryDuration defines the expected query duration. The server treats the query in different ways depending on the expected duration. This enum is ignored for aggregation queries, background queries and server versions < 6.0.
func (QueryDuration) String ¶ added in v8.4.0
func (qd QueryDuration) String() string
String returns the string representation of QueryDuration
type QueryPolicy ¶
type QueryPolicy struct {
MultiPolicy
// Expected query duration. The server treats the query in different ways depending on the expected duration.
// This field is ignored for aggregation queries, background queries and server versions < 6.0.
//
// Default: LONG
ExpectedDuration QueryDuration
// ShortQuery determines whether query expected to return less than 100 records.
// If true, the server will optimize the query for a small record set.
// This field is ignored for aggregation queries, background queries
// and server versions 6.0+.
//
// Default: false
// This field is deprecated and will eventually be removed. Use ExpectedDuration instead.
// For backwards compatibility: If ShortQuery is true, the query is treated as a short query and
// ExpectedDuration is ignored. If shortQuery is false, ExpectedDuration is used defaults to {@link QueryDuration#LONG}.
ShortQuery bool
}
QueryPolicy encapsulates parameters for policy attributes used in query operations.
Inherited Policy fields Policy.Txn are ignored in query commands.
func NewQueryPolicy ¶
func NewQueryPolicy() *QueryPolicy
NewQueryPolicy generates a new QueryPolicy instance with default values. Set MaxRetries for non-aggregation queries with a nil filter on server versions >= 4.9. All other queries are not retried.
The latest servers support retries on individual data partitions. This feature is useful when a cluster is migrating and partition(s) are missed or incomplete on the first query (with nil filter) attempt.
If the first query attempt misses 2 of 4096 partitions, then only those 2 partitions are retried in the next query attempt from the last key digest received for each respective partition. A higher default MaxRetries is used because it's wasteful to invalidate all query results because a single partition was missed.
type RawBlobValue ¶
type RawBlobValue struct {
// ParticleType signifies the data
ParticleType int
// Data carries the data
Data []byte
}
RawBlobValue encapsulates a CDT BLOB value. Notice: Do not use this value, it is for internal aerospike use only.
func NewRawBlobValue ¶
func NewRawBlobValue(pt int, b []byte) *RawBlobValue
NewRawBlobValue generates a RawBlobValue instance for a CDT List or map using a particle type.
func (*RawBlobValue) EstimateSize ¶
func (vl *RawBlobValue) EstimateSize() (int, Error)
EstimateSize returns the size of the RawBlobValue in wire protocol.
func (*RawBlobValue) GetObject ¶
func (vl *RawBlobValue) GetObject() any
GetObject returns original value as an any.
func (*RawBlobValue) GetType ¶
func (vl *RawBlobValue) GetType() int
GetType returns wire protocol value type.
func (*RawBlobValue) String ¶
func (vl *RawBlobValue) String() string
String implements Stringer interface.
type ReadModeAP ¶
type ReadModeAP int
ReadModeAP is the read policy in AP (availability) mode namespaces. It indicates how duplicates should be consulted in a read operation. Only makes a difference during migrations and only applicable in AP mode.
const ( // ReadModeAPOne indicates that a single node should be involved in the read operation. ReadModeAPOne ReadModeAP = iota // ReadModeAPAll indicates that all duplicates should be consulted in // the read operation. ReadModeAPAll )
func (ReadModeAP) String ¶ added in v8.4.0
func (rm ReadModeAP) String() string
String returns the string representation of ReadModeAP
type ReadModeSC ¶
type ReadModeSC int
ReadModeSC is the read policy in SC (strong consistency) mode namespaces. Determines SC read consistency options.
const ( // ReadModeSCSession ensures this client will only see an increasing sequence of record versions. // Client only reads from master. This is the default. ReadModeSCSession ReadModeSC = iota // ReadModeSCLinearize ensures all clients will only see an increasing sequence of record versions. // Client only reads from master. ReadModeSCLinearize // ReadModeSCAllowReplica indicates that the client may read from master or any full (non-migrating) replica. // Increasing sequence of record versions is not guaranteed. ReadModeSCAllowReplica // partitions. Increasing sequence of record versions is not guaranteed. ReadModeSCAllowUnavailable )
func (ReadModeSC) String ¶ added in v8.4.0
func (rm ReadModeSC) String() string
String returns the string representation of ReadModeSC
type Record ¶
type Record struct {
// Key is the record's key.
// Might be empty, or may only consist of digest value.
Key *Key
// Node from which the Record is originating from.
Node *Node
// Bins is the map of requested name/value bins.
Bins BinMap
// Generation shows record modification count.
Generation uint32
// Expiration is TTL (Time-To-Live).
// Number of seconds until record expires.
Expiration uint32
}
Record is the container struct for database records. Records are equivalent to rows.
type RecordExistsAction ¶
type RecordExistsAction int
RecordExistsAction determines how to handle writes when the record already exists.
const ( // UPDATE means: Create or update record. // Merge write command bins with existing bins. UPDATE RecordExistsAction = iota // UPDATE_ONLY means: Update record only. Fail if record does not exist. // Merge write command bins with existing bins. UPDATE_ONLY // REPLACE means: Create or replace record. // Delete existing bins not referenced by write command bins. // Supported by Aerospike 2 server versions >= 2.7.5 and // Aerospike 3 server versions >= 3.1.6 and later. REPLACE // REPLACE_ONLY means: Replace record only. Fail if record does not exist. // Delete existing bins not referenced by write command bins. // Supported by Aerospike 2 server versions >= 2.7.5 and // Aerospike 3 server versions >= 3.1.6 and later. REPLACE_ONLY // CREATE_ONLY means: Create only. Fail if record exists. CREATE_ONLY )
type Recordset ¶
type Recordset struct {
// contains filtered or unexported fields
}
Recordset encapsulates the result of Scan and Query commands.
func (*Recordset) Close ¶
Close all streams from different nodes. A successful close return nil, subsequent calls to the method will return ErrRecordsetClosed.err().
func (*Recordset) Errors ¶
Errors returns a read-only Error channel for the objectset. It will panic for recordsets returned for non-reflection APIs.
func (*Recordset) IsActive ¶
IsActive returns true if the operation hasn't been finished or cancelled.
func (*Recordset) Results ¶
Results returns a new receive-only channel with the results of the Scan/Query. This is a more idiomatic approach to the iterator pattern in getting the results back from the recordset, and doesn't require the user to write the ugly select in their code. Result contains a Record and an error reference.
Example:
recordset, err := client.ScanAll(nil, namespace, set)
handleError(err)
for res := range recordset.Results() {
if res.Err != nil {
// handle error here
} else {
// process record here
fmt.Println(res.Record.Bins)
}
}
type RegisterTask ¶
type RegisterTask struct {
// contains filtered or unexported fields
}
RegisterTask is used to poll for UDF registration completion.
func NewRegisterTask ¶
func NewRegisterTask(cluster *Cluster, packageName string) *RegisterTask
NewRegisterTask initializes a RegisterTask with fields needed to query server nodes.
func (*RegisterTask) IsDone ¶
func (tskr *RegisterTask) IsDone() (bool, Error)
IsDone will query all nodes for task completion status.
func (*RegisterTask) OnComplete ¶
func (tskr *RegisterTask) OnComplete() chan Error
OnComplete returns a channel that will be closed as soon as the task is finished. If an error is encountered during operation, an error will be sent on the channel.
type RemoveTask ¶
type RemoveTask struct {
// contains filtered or unexported fields
}
RemoveTask is used to poll for UDF registration completion.
func NewRemoveTask ¶
func NewRemoveTask(cluster *Cluster, packageName string) *RemoveTask
NewRemoveTask initializes a RemoveTask with fields needed to query server nodes.
func (*RemoveTask) IsDone ¶
func (tskr *RemoveTask) IsDone() (bool, Error)
IsDone will query all nodes for task completion status.
func (*RemoveTask) OnComplete ¶
func (tskr *RemoveTask) OnComplete() chan Error
OnComplete returns a channel that will be closed as soon as the task is finished. If an error is encountered during operation, an error will be sent on the channel.
type ReplicaPolicy ¶
type ReplicaPolicy int
ReplicaPolicy defines type of node partition targeted by read commands.
const ( // MASTER reads from node containing key's master partition. // This is the default behavior. MASTER ReplicaPolicy = iota // MASTER_PROLES Distributes reads across nodes containing key's master and replicated partitions // in round-robin fashion. MASTER_PROLES // RANDOM Distribute reads across all nodes in cluster in round-robin fashion. // This option is useful when the replication factor equals the number // of nodes in the cluster and the overhead of requesting proles is not desired. RANDOM // SEQUENCE Tries node containing master partition first. // If connection fails, all commands try nodes containing replicated partitions. // If socketTimeout is reached, reads also try nodes containing replicated partitions, // but writes remain on master node. SEQUENCE // PREFER_RACK Tries nodes on the same rack first. // // This option requires ClientPolicy.Rackaware to be enabled // in order to function properly. PREFER_RACK )
func GetReplicaPolicySC ¶
func GetReplicaPolicySC(policy *BasePolicy) ReplicaPolicy
GetReplicaPolicySC returns a ReplicaPolicy based on different variables in SC mode
func (ReplicaPolicy) String ¶ added in v8.4.0
func (r ReplicaPolicy) String() string
String returns the string representation of ReadModeAP
type Role ¶
type Role struct {
// Name is role name
Name string
// Privilege is the list of assigned privileges
Privileges []Privilege
// While is the list of allowable IP addresses
Whitelist []string
// ReadQuota is the maximum reads per second limit for the role
ReadQuota uint32
// WriteQuota is the maximum writes per second limit for the role
WriteQuota uint32
}
Role allows granular access to database entities for users.
type ScanPolicy ¶
type ScanPolicy struct {
MultiPolicy
}
ScanPolicy encapsulates parameters used in scan operations.
Inherited Policy fields Policy.Txn are ignored in scan commands.
func NewScanPolicy ¶
func NewScanPolicy() *ScanPolicy
NewScanPolicy creates a new ScanPolicy instance with default values. Set MaxRetries for scans on server versions >= 4.9. All other scans are not retried.
The latest servers support retries on individual data partitions. This feature is useful when a cluster is migrating and partition(s) are missed or incomplete on the first scan attempt.
If the first scan attempt misses 2 of 4096 partitions, then only those 2 partitions are retried in the next scan attempt from the last key digest received for each respective partition. A higher default MaxRetries is used because it's wasteful to invalidate all scan results because a single partition was missed.
type SelectFlag ¶ added in v8.6.0
type SelectFlag int
const ( // Return a tree from the root (bin) level to the bottom of the tree, // with only non-filtered out nodes. EXP_PATH_SELECT_MATCHING_TREE SelectFlag = 0 // Return the list of the values of the nodes finally selected by the context. // For maps, this returns the value of each (key, value) pair. EXP_PATH_SELECT_VALUE SelectFlag = 1 // Return the list of the values of the nodes finally selected by the context. // This is a synonym for EXP_PATH_SELECT_VALUE to make it clear in your // source code that you're expecting a list. EXP_PATH_SELECT_LIST_VALUE SelectFlag = 1 // Return the list of map values of the nodes finally selected by the context. // This is a synonym for EXP_PATH_SELECT_VALUE to make it clear in your // source code that you're expecting a map. See also // EXP_PATH_SELECT_MAP_KEY_VALUE. EXP_PATH_SELECT_MAP_VALUE SelectFlag = 1 // Return the list of map keys of the nodes finally selected by the context. EXP_PATH_SELECT_MAP_KEY SelectFlag = 2 // Returns the list of map (key, value) pairs of the nodes finally selected // by the context. This is a synonym for setting both // EXP_PATH_SELECT_MAP_KEY and EXP_PATH_SELECT_MAP_VALUE bits together. EXP_PATH_SELECT_MAP_KEY_VALUE SelectFlag = EXP_PATH_SELECT_MAP_KEY | EXP_PATH_SELECT_MAP_VALUE // If the expression in the context hits an invalid type (e.g., selects // as an integer when the value is a string), do not fail the operation; // just ignore those elements. Interpret UNKNOWN as false instead. EXP_PATH_SELECT_NO_FAIL SelectFlag = 0x10 )
type Statement ¶
type Statement struct {
// Namespace determines query Namespace
Namespace string
// SetName determines query Set name (Optional)
SetName string
// IndexName determines query index name (Optional)
// If not set, the server will determine the index from the filter's bin name.
IndexName string
// BinNames determines for bin projections in queries (Optional).
// Mutually exclusive with Operations.
BinNames []string
// Operations to be performed on query/execute.
// For foreground queries (Query), only read operations are allowed.
// For background queries (QueryExecute), only write operations are allowed.
// Mutually exclusive with BinNames.
Operations []*Operation
// Filter determines query index filter (Optional).
// This filter is applied to the secondary index on query.
// Query index filters must reference a bin which has a secondary index defined.
Filter *Filter
// TaskId determines query task id. (Optional)
// This value is not used anymore and will be removed later.
// Deprecated: Statement instances should not set TaskId directly since instances are meant to be immutable.
TaskId uint64
// determines if the query should return data
ReturnData bool
// contains filtered or unexported fields
}
Statement encapsulates query statement parameters.
func NewStatement ¶
NewStatement initializes a new Statement instance.
func (*Statement) IsScan ¶
IsScan determines is the Statement is a full namespace/set scan or a selective Query.
func (*Statement) SetAggregateFunction ¶
func (stmt *Statement) SetAggregateFunction(packageName string, functionName string, functionArgs []Value, returnData bool)
SetAggregateFunction sets aggregation function parameters. This function will be called on both the server and client for each selected item.
type StringNumericType ¶ added in v8.9.0
type StringNumericType int
StringNumericType is the numeric type filter used by StrIsNumericTypedOp and ExpStringIsNumericTyped. Combine with the IS_NUMERIC sub-op to restrict validation to integers or floats.
const ( // StringNumericAny matches either an integer or a floating-point number. StringNumericAny StringNumericType = 0 // StringNumericInt matches only integers. StringNumericInt StringNumericType = 1 // StringNumericFloat matches only floating-point numbers. Stricter than // "parses as a float": the string must contain a '.' followed by a digit, // so "5" is false under StringNumericFloat but true under StringNumericAny. StringNumericFloat StringNumericType = 2 )
type StringPolicy ¶ added in v8.9.0
type StringPolicy struct {
// contains filtered or unexported fields
}
StringPolicy is a per-operation policy carrying StringWriteFlags. It is passed inline to each modify [StringOperation] and is not part of the client's dynamic configuration. Mirrors how BitPolicy and HLLPolicy are scoped.
func NewStringPolicy ¶ added in v8.9.0
func NewStringPolicy(flags StringWriteFlags) *StringPolicy
NewStringPolicy returns a new StringPolicy with the supplied flags. Use bitwise OR of StringWriteFlags constants to combine flags.
type StringRegexFlags ¶ added in v8.9.0
type StringRegexFlags int
StringRegexFlags configure the regex behavior of StrRegexCompareWithFlagsOp, StrRegexReplaceOp, ExpStringRegexCompareWithFlags and ExpStringRegexReplace. Combine values with bitwise OR.
const ( // StringRegexDefault selects the default ICU regex flags (no options). StringRegexDefault StringRegexFlags = 0 // StringRegexCaseInsensitive performs case insensitive matching. StringRegexCaseInsensitive StringRegexFlags = 1 << 0 // StringRegexMultiline treats the input as a multi-line string. `^` and `$` // match the start and end of any line, not just the start and end of the input. StringRegexMultiline StringRegexFlags = 1 << 1 // StringRegexDotAll makes the `.` metacharacter match any character including // line terminators. StringRegexDotAll StringRegexFlags = 1 << 2 // StringRegexUnixLines treats only `\n` as a line terminator (Unix-style line endings). StringRegexUnixLines StringRegexFlags = 1 << 3 // StringRegexGlobal replaces all matches in the input. Only applicable to // regex replace operations. StringRegexGlobal StringRegexFlags = 1 << 4 )
type StringValue ¶
type StringValue string
StringValue encapsulates a string value.
func NewStringValue ¶
func NewStringValue(value string) StringValue
NewStringValue generates a StringValue instance.
func (StringValue) EstimateSize ¶
func (vl StringValue) EstimateSize() (int, Error)
EstimateSize returns the size of the StringValue in wire protocol.
func (StringValue) GetObject ¶
func (vl StringValue) GetObject() any
GetObject returns original value as an any.
func (StringValue) GetType ¶
func (vl StringValue) GetType() int
GetType returns wire protocol value type.
func (StringValue) String ¶
func (vl StringValue) String() string
String implements Stringer interface.
type StringWriteFlags ¶ added in v8.9.0
type StringWriteFlags int
StringWriteFlags configures the write semantics of string modify operations. Combine values with bitwise OR.
const ( // StringWriteDefault allows create or update. StringWriteDefault StringWriteFlags = 0 // StringWriteCreateOnly applies the operation only if the bin does not // already exist. A live bin fails with types.BIN_EXISTS_ERROR. // // Only the additive operations that can create a bin from empty accept this // flag: [StrInsertOp], [StrOverwriteOp], [StrConcatOp], [StrConcatListOp], // [StrAppendOp], [StrPrependOp], [StrPadStartOp], [StrPadEndOp] and // [StrRepeatOp], plus their expression equivalents. Every other string // modify operation rejects it with types.PARAMETER_ERROR. // // It is also invalid combined with [StringWriteUpdateOnly], and invalid on // an operation carrying a CDT context: both are types.PARAMETER_ERROR. // The server resolves all three of these while parsing arguments, so // [StringWriteNoFail] does not suppress them. StringWriteCreateOnly StringWriteFlags = 1 // StringWriteUpdateOnly applies the operation only to an existing bin, // disabling bin creation. An absent bin is a no-op rather than a create. // Valid on every string modify operation. Cannot be combined with // [StringWriteCreateOnly]. StringWriteUpdateOnly StringWriteFlags = 2 // StringWriteNoFail suppresses the failure if the operation cannot be // applied, leaving the bin unchanged. The bin — and the value a modify // expression evaluates to — keeps the unmodified source string. // // It covers argument and size validation, the operation itself, and a // [StringWriteCreateOnly] conflict on a live bin. It does not cover a // malformed argument list, a non-string bin, invalid UTF-8 in either the // source or the result, or the [StringWriteCreateOnly] validations above. // // An absent bin is not a failure and does not depend on this flag: the // create-capable operations listed under [StringWriteCreateOnly] create it, // every other operation is a no-op. StringWriteNoFail StringWriteFlags = 4 )
type Task ¶
type Task interface {
IsDone() (bool, Error)
OnComplete() chan Error
// contains filtered or unexported methods
}
Task interface defines methods for asynchronous tasks.
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
Transaction. Each command in the Transaction must use the same namespace.
func NewTxn ¶
func NewTxn() *Txn
Create Transaction, assign random transaction id and initialize reads/writes hashmaps with default capacities.
The default client Transaction timeout is zero. This means use the server configuration transaction-duration as the Transaction timeout. The default transaction-duration is 10 seconds.
func NewTxnWithCapacity ¶
Create Transaction, assign random transaction id and initialize reads/writes hashmaps with given capacities.
readsCapacity expected number of record reads in the Transaction. Minimum value is 16. writesCapacity expected number of record writes in the Transaction. Minimum value is 16.
func (*Txn) CloseMonitor ¶
Return if the MRT monitor record should be closed/deleted. For internal use only.
func (*Txn) GetReadVersion ¶
Get record version for a given key.
func (*Txn) MonitorExists ¶
Does Transaction monitor record exist.
func (*Txn) OnWrite ¶
func (txn *Txn) OnWrite(key *Key, version *uint64, resultCode types.ResultCode)
Process the results of a record write. For internal use only.
func (*Txn) OnWriteInDoubt ¶
Add key to write hash when write command is in doubt (usually caused by timeout).
func (*Txn) ReadExistsForKey ¶
Get all read keys and their versions.
func (*Txn) SetInDoubt ¶
Set Transaction inDoubt. For internal use only.
func (*Txn) SetNamespace ¶
Set Transaction namespace only if doesn't already exist. If namespace already exists, verify new namespace is the same.
func (*Txn) SetTimeout ¶
Set Transaction timeout in seconds. The timer starts when the Transaction monitor record is created. This occurs when the first command in the Transaction is executed. If the timeout is reached before a commit or abort is called, the server will expire and rollback the Transaction.
If the Transaction timeout is zero, the server configuration transaction-duration is used. The default transaction-duration is 10 seconds.
func (*Txn) VerifyCommand ¶
Verify that the Transaction state allows future commands.
func (*Txn) WriteExistsForKey ¶
Get all write keys and their versions.
type TxnError ¶
type TxnError struct {
AerospikeError
// Error status of the attempted commit.
CommitError CommitError
// Verify result for each read key in the Transaction. May be nil if failure occurred before verify.
VerifyRecords []*BatchRecord
// Roll forward/backward result for each write key in the Transaction. May be nil if failure occurred before
// roll forward/backward.
RollRecords []*BatchRecord
}
TxnError implements Error interface for aerospike multi-record transaction specific errors.
type TxnMonitor ¶
type TxnMonitor struct{}
type TxnRoll ¶
type TxnRoll struct {
// contains filtered or unexported fields
}
func NewTxnRoll ¶
func (*TxnRoll) Abort ¶
func (txr *TxnRoll) Abort(rollPolicy *BatchPolicy) (AbortStatus, Error)
func (*TxnRoll) Commit ¶
func (txr *TxnRoll) Commit(rollPolicy *BatchPolicy) (CommitStatus, Error)
func (*TxnRoll) MarkRollForward ¶
func (txr *TxnRoll) MarkRollForward(writePolicy *WritePolicy, txnKey *Key) Error
func (*TxnRoll) Verify ¶
func (txr *TxnRoll) Verify(verifyPolicy, rollPolicy *BatchPolicy) Error
func (*TxnRoll) VerifyRecordVersions ¶
func (txr *TxnRoll) VerifyRecordVersions(verifyPolicy *BatchPolicy) Error
type TxnRollPolicy ¶
type TxnRollPolicy struct {
BatchPolicy
}
Transaction policy fields used to batch roll forward/backward records on commit or abort. Used a placeholder for now as there are no additional fields beyond BatchPolicy.
func NewTxnRollPolicy ¶
func NewTxnRollPolicy() *TxnRollPolicy
NewTxnRollPolicy creates a new TxnRollPolicy instance with default values.
type TxnVerifyPolicy ¶
type TxnVerifyPolicy struct {
BatchPolicy
}
Transaction policy fields used to batch verify record versions on commit. Used a placeholder for now as there are no additional fields beyond BatchPolicy.
func NewTxnVerifyPolicy ¶
func NewTxnVerifyPolicy() *TxnVerifyPolicy
NewTxnRollPolicy creates a new TxnVerifyPolicy instance with default values.
type UDF ¶
type UDF struct {
// Filename of the UDF
Filename string
// Hash digest of the UDF
Hash string
// Language of UDF
Language Language
}
UDF carries information about UDFs on the server
type UserRoles ¶
type UserRoles struct {
// User name.
User string
// Roles is a list of assigned roles.
Roles []string
// ReadInfo is the list of read statistics. List may be nil.
// Current statistics by offset are:
//
// 0: read quota in records per second
// 1: single record read command rate (TPS)
// 2: read scan/query record per second rate (RPS)
// 3: number of limitless read scans/queries
//
// Future server releases may add additional statistics.
ReadInfo []int
// WriteInfo is the list of write statistics. List may be nil.
// Current statistics by offset are:
//
// 0: write quota in records per second
// 1: single record write command rate (TPS)
// 2: write scan/query record per second rate (RPS)
// 3: number of limitless write scans/queries
//
// Future server releases may add additional statistics.
WriteInfo []int
// ConnsInUse is the number of currently open connections for the user
ConnsInUse int
}
UserRoles contains information about a user.
type Value ¶
type Value interface {
// Calculate number of vl.bytes necessary to serialize the value in the wire protocol.
EstimateSize() (int, Error)
// GetType returns wire protocol value type.
GetType() int
// GetObject returns original value as an any.
GetObject() any
// String implements Stringer interface.
String() string
// contains filtered or unexported methods
}
Value interface is used to efficiently serialize objects into the wire protocol.
func NewValue ¶
NewValue generates a new Value object based on the type. If the type is not supported, NewValue will panic. This method is a convenience method, and should not be used when absolute performance is required unless for the reason mentioned below.
If you have custom maps or slices like:
type MyMap map[primitive1]primitive2, eg: map[int]string
or
type MySlice []primitive, eg: []float64
cast them to their primitive type when passing them to this method:
v := NewValue(map[int]string(myVar)) v := NewValue([]float64(myVar))
This way you will avoid hitting reflection. To completely avoid reflection in the library, use the build tag: as_performance while building your program.
type ValueArray ¶
type ValueArray []Value
ValueArray encapsulates an array of Value. Supported by Aerospike 3+ servers only.
func NewValueArray ¶
func NewValueArray(array []Value) *ValueArray
NewValueArray generates a ValueArray instance.
func (ValueArray) EstimateSize ¶
func (va ValueArray) EstimateSize() (int, Error)
EstimateSize returns the size of the ValueArray in wire protocol.
func (ValueArray) GetObject ¶
func (va ValueArray) GetObject() any
GetObject returns original value as an any.
func (ValueArray) GetType ¶
func (va ValueArray) GetType() int
GetType returns wire protocol value type.
func (ValueArray) String ¶
func (va ValueArray) String() string
String implements Stringer interface.
type WildCardValue ¶
type WildCardValue struct{}
WildCardValue is an empty value.
func NewWildCardValue ¶
func NewWildCardValue() WildCardValue
NewWildCardValue generates a WildCardValue instance.
func (WildCardValue) EstimateSize ¶
func (vl WildCardValue) EstimateSize() (int, Error)
EstimateSize returns the size of the WildCardValue in wire protocol.
func (WildCardValue) GetObject ¶
func (vl WildCardValue) GetObject() any
GetObject returns original value as an any.
func (WildCardValue) GetType ¶
func (vl WildCardValue) GetType() int
GetType returns wire protocol value type.
func (WildCardValue) String ¶
func (vl WildCardValue) String() string
type WritePolicy ¶
type WritePolicy struct {
BasePolicy
// RecordExistsAction qualifies how to handle writes where the record already exists.
RecordExistsAction RecordExistsAction //= RecordExistsAction.UPDATE;
// GenerationPolicy qualifies how to handle record writes based on record generation. The default (NONE)
// indicates that the generation is not used to restrict writes.
GenerationPolicy GenerationPolicy //= GenerationPolicy.NONE;
// Desired consistency guarantee when committing a command on the server. The default
// (COMMIT_ALL) indicates that the server should wait for master and all replica commits to
// be successful before returning success to the client.
CommitLevel CommitLevel //= COMMIT_ALL
// Generation determines expected generation.
// Generation is the number of times a record has been
// modified (including creation) on the server.
// If a write operation is creating a record, the expected generation would be 0.
Generation uint32
// Expiration determines record expiration in seconds. Also known as TTL (Time-To-Live).
// Seconds record will live before being removed by the server.
// Expiration values:
// TTLServerDefault (0): Default to namespace configuration variable "default-ttl" on the server.
// TTLDontExpire (MaxUint32): Never expire for Aerospike 2 server versions >= 2.7.2 and Aerospike 3+ server
// TTLDontUpdate (MaxUint32 - 1): Do not change ttl when record is written. Supported by Aerospike server versions >= 3.10.1
// > 0: Actual expiration in seconds.
Expiration uint32
// RespondPerEachOp defines for client.Operate() method, return a result for every operation.
// Some list operations do not return results by default (ListClearOp() for example).
// This can sometimes make it difficult to determine the desired result offset in the returned
// bin's result list.
//
// Setting RespondPerEachOp to true makes it easier to identify the desired result offset
// (result offset equals bin's operate sequence). This only makes sense when multiple list
// operations are used in one operate call and some of those operations do not return results
// by default.
RespondPerEachOp bool
// DurableDelete leaves a tombstone for the record if the command results in a record deletion.
// This prevents deleted records from reappearing after node failures.
// Valid for Aerospike Server Enterprise Edition 3.10+ only.
DurableDelete bool
// Execute the write command only if the record is not already locked by this transaction.
// If this field is true and the record is already locked by this transaction, the command
// will return an error with the [types.MRT_ALREADY_LOCKED] error code.
//
// This field is useful for safely retrying non-idempotent writes as an alternative to simply
// aborting the transaction.
//
// Default: false
OnLockingOnly bool
}
WritePolicy encapsulates parameters for policy attributes used in write operations. This object is passed into methods where database writes can occur.
func NewWritePolicy ¶
func NewWritePolicy(generation, expiration uint32) *WritePolicy
NewWritePolicy initializes a new WritePolicy instance with default parameters.
Source Files
¶
- abort_status.go
- admin_command.go
- admin_policy.go
- aerospike.go
- auth_mode.go
- base_read_command.go
- base_write_command.go
- batch_attr.go
- batch_command.go
- batch_command_delete.go
- batch_command_exists.go
- batch_command_get.go
- batch_command_get_reflect.go
- batch_command_operate.go
- batch_command_reflect.go
- batch_command_udf.go
- batch_delete.go
- batch_delete_policy.go
- batch_executer.go
- batch_index_command_get.go
- batch_node.go
- batch_node_list.go
- batch_offsets.go
- batch_policy.go
- batch_read.go
- batch_read_policy.go
- batch_record.go
- batch_udf.go
- batch_udf_policy.go
- batch_write.go
- batch_write_policy.go
- bin.go
- bit_overflow_action.go
- bit_policy.go
- bit_resize_flags.go
- bit_write_flags.go
- buffered_connection.go
- bytes_buffer.go
- cdt.go
- cdt_bitwise.go
- cdt_context.go
- cdt_list.go
- cdt_map.go
- cdt_operation.go
- cdt_string.go
- client.go
- client_appengine_exclusions.go
- client_policy.go
- client_reflect.go
- cluster.go
- command.go
- commit_error.go
- commit_policy.go
- commit_status.go
- config.go
- connection.go
- connection_heap.go
- delete_command.go
- error.go
- execute_command.go
- execute_task.go
- exists_command.go
- exp_bit.go
- exp_cdt.go
- exp_hll.go
- exp_list.go
- exp_map.go
- exp_operation.go
- exp_string.go
- expression.go
- expression_trace.go
- field_type.go
- filter.go
- generation_policy.go
- generics.go
- hll_operation.go
- hll_policy.go
- hll_write_flags.go
- host.go
- index_collection_type.go
- index_type.go
- info.go
- info_policy.go
- key.go
- key_helper.go
- language.go
- login_command.go
- marshal.go
- metadata_policy.go
- metrics_policy.go
- multi_command.go
- multi_policy.go
- node.go
- node_stats.go
- node_validator.go
- operate_args.go
- operate_command_read.go
- operate_command_write.go
- operation.go
- packer.go
- packer_reflect.go
- partition.go
- partition_filter.go
- partition_parser.go
- partition_status.go
- partition_tracker.go
- partitions.go
- peers.go
- peers_parser.go
- policy.go
- privilege.go
- query_aggregate_command.go
- query_command.go
- query_duration.go
- query_executor.go
- query_objects_executor.go
- query_partition_command.go
- query_partitiopn_objects_command.go
- query_policy.go
- read_command.go
- read_command_reflect.go
- read_header_command.go
- read_mode_ap.go
- read_mode_sc.go
- record.go
- record_exists_action.go
- record_parser.go
- recordset.go
- replica_policy.go
- role.go
- scan_executor.go
- scan_objects_executor.go
- scan_partition_command.go
- scan_partition_objects_command.go
- scan_policy.go
- server_command.go
- single_command.go
- statement.go
- task.go
- task_drop_index.go
- task_index.go
- task_register.go
- task_remove.go
- touch_command.go
- txn.go
- txn_add_keys_command.go
- txn_close.go
- txn_error.go
- txn_mark_roll_forward.go
- txn_monitor.go
- txn_roll.go
- txn_roll_batch.go
- txn_roll_batch_single.go
- txn_roll_policy.go
- txn_verify_batch.go
- txn_verify_batch_single.go
- txn_verify_policy.go
- udf.go
- unpacker.go
- user_roles.go
- utf8_validate.go
- value.go
- value_helpers.go
- value_reflect.go
- werrgroup.go
- write_command.go
- write_payload_command.go
- write_policy.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dynconfig provides a configuration provider interface and structures for loading and managing dynamic configurations in a system.
|
Package dynconfig provides a configuration provider interface and structures for loading and managing dynamic configurations in a system. |
|
Command examples runs the documentation code examples against a live Aerospike server and verifies their results.
|
Command examples runs the documentation code examples against a live Aerospike server and verifies their results. |
|
fixtures
Package fixtures holds the Setup/Validate/Cleanup steps that verify the documentation examples, plus the helpers they share.
|
Package fixtures holds the Setup/Validate/Cleanup steps that verify the documentation examples, plus the helpers they share. |
|
internal
|
|
|
pkg
|
|
|
ripemd160
Package ripemd160 implements the RIPEMD-160 hash algorithm.
|
Package ripemd160 implements the RIPEMD-160 hash algorithm. |
|
tools
|
|
|
asinfo
command
|
|
|
benchmark
command
|
|
|
cli
command
|
|
|
utils
|
|