tablestore

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: Apache-2.0 Imports: 24 Imported by: 87

Documentation

Index

Constants

View Source
const (
	OTS_CLIENT_UNKNOWN = "OTSClientUnknownError"

	ROW_OPERATION_CONFLICT   = "OTSRowOperationConflict"
	NOT_ENOUGH_CAPACITY_UNIT = "OTSNotEnoughCapacityUnit"
	TABLE_NOT_READY          = "OTSTableNotReady"
	PARTITION_UNAVAILABLE    = "OTSPartitionUnavailable"
	SERVER_BUSY              = "OTSServerBusy"
	STORAGE_SERVER_BUSY      = "OTSStorageServerBusy"
	QUOTA_EXHAUSTED          = "OTSQuotaExhausted"

	STORAGE_TIMEOUT       = "OTSTimeout"
	SERVER_UNAVAILABLE    = "OTSServerUnavailable"
	INTERNAL_SERVER_ERROR = "OTSInternalServerError"
)
View Source
const (
	DefaultRetryInterval = 10
	MaxRetryInterval     = 320
)
View Source
const (
	HEADER = 0x75

	// tag type
	TAG_ROW_PK             = 0x1
	TAG_ROW_DATA           = 0x2
	TAG_CELL               = 0x3
	TAG_CELL_NAME          = 0x4
	TAG_CELL_VALUE         = 0x5
	TAG_CELL_TYPE          = 0x6
	TAG_CELL_TIMESTAMP     = 0x7
	TAG_DELETE_ROW_MARKER  = 0x8
	TAG_ROW_CHECKSUM       = 0x9
	TAG_CELL_CHECKSUM      = 0x0A
	TAG_EXTENSION          = 0x0B
	TAG_SEQ_INFO           = 0x0C
	TAG_SEQ_INFO_EPOCH     = 0x0D
	TAG_SEQ_INFO_TS        = 0x0E
	TAG_SEQ_INFO_ROW_INDEX = 0x0F

	// cell op type
	DELETE_ALL_VERSION = 0x1
	DELETE_ONE_VERSION = 0x3
	INCREMENT          = 0x4

	// variant type
	VT_INTEGER = 0x0
	VT_DOUBLE  = 0x1
	VT_BOOLEAN = 0x2
	VT_STRING  = 0x3

	//public final static byte VT_NULL = 0x6;
	VT_BLOB           = 0x7
	VT_INF_MIN        = 0x9
	VT_INF_MAX        = 0xa
	VT_AUTO_INCREMENT = 0xb

	LITTLE_ENDIAN_32_SIZE = 4
	LITTLE_ENDIAN_64_SIZE = 8
)
View Source
const (
	Version    = "1.0"
	ApiVersion = "2015-12-31"
)
View Source
const (
	MaxValue = "_get_range_max"
	MinValue = "_get_range_min"
)

Variables

This section is empty.

Functions

func Assert

func Assert(cond bool, msg string)

func ConvertIndexTypeToPBIndexType

func ConvertIndexTypeToPBIndexType(indexType IndexType) otsprotocol.IndexType

func ConvertIndexTypeToPBIndexUpdateMode

func ConvertIndexTypeToPBIndexUpdateMode(indexType IndexType) otsprotocol.IndexUpdateMode

func ConvertToPbCastType

func ConvertToPbCastType(variantType VariantType) *otsprotocol.VariantType

func NewSingleColumnValueFilter

func NewSingleColumnValueFilter(condition *SingleColumnCondition) *otsprotocol.SingleColumnValueFilter

Types

type AbortTransactionRequest

type AbortTransactionRequest struct {
	TransactionId *string
}

type AbortTransactionResponse

type AbortTransactionResponse struct {
	ResponseInfo
}

type ActionType

type ActionType int
const (
	AT_Put ActionType = iota
	AT_Update
	AT_Delete
)

func (ActionType) String

func (this ActionType) String() string

type AddDefinedColumnRequest

type AddDefinedColumnRequest struct {
	TableName      string
	DefinedColumns []*DefinedColumnSchema
}

func (*AddDefinedColumnRequest) AddDefinedColumn

func (request *AddDefinedColumnRequest) AddDefinedColumn(name string, definedType DefinedColumnType)

type AddDefinedColumnResponse

type AddDefinedColumnResponse struct {
	ResponseInfo
}

type Analyzer

type Analyzer string
const (
	Analyzer_SingleWord Analyzer = "single_word"
	Analyzer_MaxWord    Analyzer = "max_word"
	Analyzer_MinWord    Analyzer = "min_word"
	Analyzer_Split      Analyzer = "split"
	Analyzer_Fuzzy      Analyzer = "fuzzy"
)

type AttributeColumn

type AttributeColumn struct {
	ColumnName string
	Value      interface{}
	Timestamp  int64
}

type BatchGetRowRequest

type BatchGetRowRequest struct {
	MultiRowQueryCriteria []*MultiRowQueryCriteria
}

type BatchGetRowResponse

type BatchGetRowResponse struct {
	TableToRowsResult map[string][]RowResult
	ResponseInfo
}

type BatchWriteRowRequest

type BatchWriteRowRequest struct {
	RowChangesGroupByTable map[string][]RowChange
}

func (*BatchWriteRowRequest) AddRowChange

func (request *BatchWriteRowRequest) AddRowChange(change RowChange)

type BatchWriteRowResponse

type BatchWriteRowResponse struct {
	TableToRowsResult map[string][]RowResult
	ResponseInfo
}

type ClientOption

type ClientOption func(*TableStoreClient)

type Column

type Column struct {
	Name         []byte
	Value        ColumnValue
	Type         byte
	Timestamp    int64
	HasType      bool
	HasTimestamp bool
	IgnoreValue  bool
}

func NewColumn

func NewColumn(name []byte, value interface{}) *Column

type ColumnFilter

type ColumnFilter interface {
	Serialize() []byte
	ToFilter() *otsprotocol.Filter
}

type ColumnMap

type ColumnMap struct {
	Columns map[string][]*AttributeColumn
	// contains filtered or unexported fields
}

func (*ColumnMap) GetRange

func (columnMap *ColumnMap) GetRange(start int, count int) ([]*AttributeColumn, error)

type ColumnToUpdate

type ColumnToUpdate struct {
	ColumnName   string
	Type         byte
	Timestamp    int64
	HasType      bool
	HasTimestamp bool
	IgnoreValue  bool
	Value        interface{}
}

type ColumnType

type ColumnType int32
const (
	ColumnType_STRING  ColumnType = 1
	ColumnType_INTEGER ColumnType = 2
	ColumnType_BOOLEAN ColumnType = 3
	ColumnType_DOUBLE  ColumnType = 4
	ColumnType_BINARY  ColumnType = 5
)

type ColumnValue

type ColumnValue struct {
	Type  ColumnType
	Value interface{}
}

type ColumnsToGet

type ColumnsToGet struct {
	Columns   []string
	ReturnAll bool
}

type CommitTransactionRequest

type CommitTransactionRequest struct {
	TransactionId *string
}

type CommitTransactionResponse

type CommitTransactionResponse struct {
	ResponseInfo
}

type ComparatorType

type ComparatorType int32
const (
	CT_EQUAL         ComparatorType = 1
	CT_NOT_EQUAL     ComparatorType = 2
	CT_GREATER_THAN  ComparatorType = 3
	CT_GREATER_EQUAL ComparatorType = 4
	CT_LESS_THAN     ComparatorType = 5
	CT_LESS_EQUAL    ComparatorType = 6
)

func (*ComparatorType) ConvertToPbComparatorType

func (comparatorType *ComparatorType) ConvertToPbComparatorType() otsprotocol.ComparatorType

type CompositeColumnValueFilter

type CompositeColumnValueFilter struct {
	Operator LogicalOperator
	Filters  []ColumnFilter
}

func NewCompositeColumnCondition

func NewCompositeColumnCondition(lo LogicalOperator) *CompositeColumnValueFilter

func (*CompositeColumnValueFilter) AddFilter

func (ccvfilter *CompositeColumnValueFilter) AddFilter(filter ColumnFilter)

func (*CompositeColumnValueFilter) Serialize

func (ccvfilter *CompositeColumnValueFilter) Serialize() []byte

func (*CompositeColumnValueFilter) ToFilter

func (ccvfilter *CompositeColumnValueFilter) ToFilter() *otsprotocol.Filter

type ComputeSplitPointsBySizeRequest

type ComputeSplitPointsBySizeRequest struct {
	TableName string
	SplitSize int64
}

type ComputeSplitPointsBySizeResponse

type ComputeSplitPointsBySizeResponse struct {
	SchemaEntry []*PrimaryKeySchema
	Splits      []*Split
	ResponseInfo
}

type ConsumedCapacityUnit

type ConsumedCapacityUnit struct {
	Read  int32
	Write int32
}

type CreateIndexRequest

type CreateIndexRequest struct {
	MainTableName   string
	IndexMeta       *IndexMeta
	IncludeBaseData bool
}

type CreateIndexResponse

type CreateIndexResponse struct {
	ResponseInfo
}

type CreateSearchIndexRequest

type CreateSearchIndexRequest struct {
	TableName   string
	IndexName   string
	IndexSchema *IndexSchema
}

type CreateSearchIndexResponse

type CreateSearchIndexResponse struct {
	ResponseInfo ResponseInfo
}

type CreateTableRequest

type CreateTableRequest struct {
	TableMeta          *TableMeta
	TableOption        *TableOption
	ReservedThroughput *ReservedThroughput
	StreamSpec         *StreamSpecification
	IndexMetas         []*IndexMeta
}

func (*CreateTableRequest) AddIndexMeta

func (request *CreateTableRequest) AddIndexMeta(meta *IndexMeta)

type CreateTableResponse

type CreateTableResponse struct {
	ResponseInfo
}

type CustomizedRetryNotMatterActions

type CustomizedRetryNotMatterActions func(errorCode string, errorMsg string, action string, httpStatus int) bool

type DefinedColumnSchema

type DefinedColumnSchema struct {
	Name       string
	ColumnType DefinedColumnType
}

type DefinedColumnType

type DefinedColumnType int32
const (
	/**
	 * 64位整数。
	 */
	DefinedColumn_INTEGER DefinedColumnType = 1

	/**
	 * 浮点数。
	 */
	DefinedColumn_DOUBLE DefinedColumnType = 2

	/**
	 * 布尔值。
	 */
	DefinedColumn_BOOLEAN DefinedColumnType = 3

	/**
	 * 字符串。
	 */
	DefinedColumn_STRING DefinedColumnType = 4

	/**
	 * BINARY。
	 */
	DefinedColumn_BINARY DefinedColumnType = 5
)

func ConvertPbDefinedColumnType

func ConvertPbDefinedColumnType(columnType otsprotocol.DefinedColumnType) DefinedColumnType

func (DefinedColumnType) ConvertToPbDefinedColumnType

func (columnType DefinedColumnType) ConvertToPbDefinedColumnType() otsprotocol.DefinedColumnType

type DeleteDefinedColumnRequest

type DeleteDefinedColumnRequest struct {
	TableName      string
	DefinedColumns []string
}

type DeleteDefinedColumnResponse

type DeleteDefinedColumnResponse struct {
	ResponseInfo
}

type DeleteIndexRequest

type DeleteIndexRequest struct {
	MainTableName string
	IndexName     string
}

type DeleteIndexResponse

type DeleteIndexResponse struct {
	ResponseInfo
}

type DeleteRowChange

type DeleteRowChange struct {
	TableName     string
	PrimaryKey    *PrimaryKey
	Condition     *RowCondition
	TransactionId *string
}

func (*DeleteRowChange) GetTableName

func (rowchange *DeleteRowChange) GetTableName() string

func (*DeleteRowChange) Serialize

func (rowchange *DeleteRowChange) Serialize() []byte

func (*DeleteRowChange) SetColumnCondition

func (rowchange *DeleteRowChange) SetColumnCondition(condition ColumnFilter)

func (*DeleteRowChange) SetCondition

func (rowchange *DeleteRowChange) SetCondition(rowExistenceExpectation RowExistenceExpectation)

type DeleteRowRequest

type DeleteRowRequest struct {
	DeleteRowChange *DeleteRowChange
}

type DeleteRowResponse

type DeleteRowResponse struct {
	ConsumedCapacityUnit *ConsumedCapacityUnit
	ResponseInfo
}

type DeleteSearchIndexRequest

type DeleteSearchIndexRequest struct {
	TableName string
	IndexName string
}

type DeleteSearchIndexResponse

type DeleteSearchIndexResponse struct {
	ResponseInfo ResponseInfo
}

type DeleteTableRequest

type DeleteTableRequest struct {
	TableName string
}

type DeleteTableResponse

type DeleteTableResponse struct {
	ResponseInfo
}

type DescribeSearchIndexRequest

type DescribeSearchIndexRequest struct {
	TableName string
	IndexName string
}

type DescribeSearchIndexResponse

type DescribeSearchIndexResponse struct {
	Schema       *IndexSchema
	SyncStat     *SyncStat
	ResponseInfo ResponseInfo
}

type DescribeStreamRequest

type DescribeStreamRequest struct {
	StreamId              *StreamId // required
	InclusiveStartShardId *ShardId  // optional
	ShardLimit            *int32    // optional
}

type DescribeStreamResponse

type DescribeStreamResponse struct {
	StreamId       *StreamId    // required
	ExpirationTime int32        // in hours
	TableName      *string      // required
	CreationTime   int64        // in usec
	Status         StreamStatus // required
	Shards         []*StreamShard
	NextShardId    *ShardId // optional. nil means "no more shards"
	ResponseInfo
}

type DescribeTableRequest

type DescribeTableRequest struct {
	TableName string
}

type DescribeTableResponse

type DescribeTableResponse struct {
	TableMeta          *TableMeta
	TableOption        *TableOption
	ReservedThroughput *ReservedThroughput
	StreamDetails      *StreamDetails
	IndexMetas         []*IndexMeta
	ResponseInfo
}

type Direction

type Direction int32
const (
	FORWARD  Direction = 0
	BACKWARD Direction = 1
)

func (Direction) ToDirection

func (direction Direction) ToDirection() otsprotocol.Direction

type Error

type Error struct {
	Code    string
	Message string
}

type FieldSchema

type FieldSchema struct {
	FieldName         *string
	FieldType         FieldType
	Index             *bool
	IndexOptions      *IndexOptions
	Analyzer          *Analyzer
	AnalyzerParameter interface{}
	EnableSortAndAgg  *bool
	Store             *bool
	IsArray           *bool
	FieldSchemas      []*FieldSchema
}

func (*FieldSchema) String

func (fs *FieldSchema) String() string

type FieldType

type FieldType int32
const (
	FieldType_LONG      FieldType = 1
	FieldType_DOUBLE    FieldType = 2
	FieldType_BOOLEAN   FieldType = 3
	FieldType_KEYWORD   FieldType = 4
	FieldType_TEXT      FieldType = 5
	FieldType_NESTED    FieldType = 6
	FieldType_GEO_POINT FieldType = 7
)

type FilterType

type FilterType int32
const (
	FT_SINGLE_COLUMN_VALUE    FilterType = 1
	FT_COMPOSITE_COLUMN_VALUE FilterType = 2
	FT_COLUMN_PAGINATION      FilterType = 3
)

type FuzzyAnalyzerParameter

type FuzzyAnalyzerParameter struct {
	MinChars int32
	MaxChars int32
}

type GetHttpClient

type GetHttpClient func() IHttpClient

type GetRangeRequest

type GetRangeRequest struct {
	RangeRowQueryCriteria *RangeRowQueryCriteria
}

type GetRangeResponse

type GetRangeResponse struct {
	Rows                 []*Row
	ConsumedCapacityUnit *ConsumedCapacityUnit
	NextStartPrimaryKey  *PrimaryKey
	ResponseInfo
}

type GetRowRequest

type GetRowRequest struct {
	SingleRowQueryCriteria *SingleRowQueryCriteria
}

type GetRowResponse

type GetRowResponse struct {
	PrimaryKey           PrimaryKey
	Columns              []*AttributeColumn
	ConsumedCapacityUnit *ConsumedCapacityUnit

	ResponseInfo
	// contains filtered or unexported fields
}

func (*GetRowResponse) GetColumnMap

func (response *GetRowResponse) GetColumnMap() *ColumnMap

type GetShardIteratorRequest

type GetShardIteratorRequest struct {
	StreamId  *StreamId // required
	ShardId   *ShardId  // required
	Timestamp *int64
	Token     *string
}

type GetShardIteratorResponse

type GetShardIteratorResponse struct {
	ShardIterator *ShardIterator // required
	Token         *string
	ResponseInfo
}

type GetStreamRecordRequest

type GetStreamRecordRequest struct {
	ShardIterator *ShardIterator // required
	Limit         *int32         // optional. max records which will reside in response
}

type GetStreamRecordResponse

type GetStreamRecordResponse struct {
	Records           []*StreamRecord
	NextShardIterator *ShardIterator // optional. an indicator to be used to read more records in this shard
	ResponseInfo
}

type HTTPTimeout

type HTTPTimeout struct {
	ConnectionTimeout time.Duration
	RequestTimeout    time.Duration
}

type IHttpClient

type IHttpClient interface {
	Do(*http.Request) (*http.Response, error)
	New(*http.Client)
}

use this to mock http.client for testing

type IndexInfo

type IndexInfo struct {
	TableName string
	IndexName string
}

type IndexMeta

type IndexMeta struct {
	IndexName      string
	Primarykey     []string
	DefinedColumns []string
	IndexType      IndexType
}

func ConvertPbIndexMetaToIndexMeta

func ConvertPbIndexMetaToIndexMeta(meta *otsprotocol.IndexMeta) *IndexMeta

func (*IndexMeta) AddDefinedColumn

func (meta *IndexMeta) AddDefinedColumn(name string)

func (*IndexMeta) AddPrimaryKeyColumn

func (meta *IndexMeta) AddPrimaryKeyColumn(name string)

func (*IndexMeta) ConvertToPbIndexMeta

func (meta *IndexMeta) ConvertToPbIndexMeta() *otsprotocol.IndexMeta

func (*IndexMeta) SetAsGlobalIndex

func (meta *IndexMeta) SetAsGlobalIndex()

func (*IndexMeta) SetAsLocalIndex

func (meta *IndexMeta) SetAsLocalIndex()

type IndexOptions

type IndexOptions int32
const (
	IndexOptions_DOCS      IndexOptions = 1
	IndexOptions_FREQS     IndexOptions = 2
	IndexOptions_POSITIONS IndexOptions = 3
	IndexOptions_OFFSETS   IndexOptions = 4
)

type IndexSchema

type IndexSchema struct {
	IndexSetting *IndexSetting
	FieldSchemas []*FieldSchema
	IndexSort    *search.Sort
}

type IndexSetting

type IndexSetting struct {
	RoutingFields []string
}

type IndexType

type IndexType int32
const (
	IT_GLOBAL_INDEX IndexType = 0
	IT_LOCAL_INDEX  IndexType = 1
)

func ConvertPbIndexTypeToIndexType

func ConvertPbIndexTypeToIndexType(indexType *otsprotocol.IndexType) IndexType

type ListSearchIndexRequest

type ListSearchIndexRequest struct {
	TableName string
}

type ListSearchIndexResponse

type ListSearchIndexResponse struct {
	IndexInfo    []*IndexInfo
	ResponseInfo ResponseInfo
}

type ListStreamRequest

type ListStreamRequest struct {
	TableName *string
}

type ListStreamResponse

type ListStreamResponse struct {
	Streams []Stream
	ResponseInfo
}

type ListTableResponse

type ListTableResponse struct {
	TableNames []string
	ResponseInfo
}

type LogicalOperator

type LogicalOperator int32
const (
	LO_NOT LogicalOperator = 1
	LO_AND LogicalOperator = 2
	LO_OR  LogicalOperator = 3
)

func (*LogicalOperator) ConvertToPbLoType

func (loType *LogicalOperator) ConvertToPbLoType() otsprotocol.LogicalOperator

type MultiRowQueryCriteria

type MultiRowQueryCriteria struct {
	PrimaryKey   []*PrimaryKey
	ColumnsToGet []string
	TableName    string
	MaxVersion   int
	TimeRange    *TimeRange
	Filter       ColumnFilter
	StartColumn  *string
	EndColumn    *string
}

func (*MultiRowQueryCriteria) AddColumnToGet

func (rowQueryCriteria *MultiRowQueryCriteria) AddColumnToGet(columnName string)

func (*MultiRowQueryCriteria) AddRow

func (rowQueryCriteria *MultiRowQueryCriteria) AddRow(pk *PrimaryKey)

func (*MultiRowQueryCriteria) SetFilter

func (Criteria *MultiRowQueryCriteria) SetFilter(filter ColumnFilter)

type OtsError

type OtsError struct {
	Code      string
	Message   string
	RequestId string

	HttpStatusCode int
}

func (*OtsError) Error

func (e *OtsError) Error() string

type PaginationFilter

type PaginationFilter struct {
	Offset int32
	Limit  int32
}

func (*PaginationFilter) Serialize

func (pageFilter *PaginationFilter) Serialize() []byte

func (*PaginationFilter) ToFilter

func (pageFilter *PaginationFilter) ToFilter() *otsprotocol.Filter

type PlainBufferCell

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

type PlainBufferRow

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

type PrimaryKey

type PrimaryKey struct {
	PrimaryKeys []*PrimaryKeyColumn
}

func (*PrimaryKey) AddPrimaryKeyColumn

func (pk *PrimaryKey) AddPrimaryKeyColumn(primaryKeyName string, value interface{})

func (*PrimaryKey) AddPrimaryKeyColumnWithAutoIncrement

func (pk *PrimaryKey) AddPrimaryKeyColumnWithAutoIncrement(primaryKeyName string)

func (*PrimaryKey) AddPrimaryKeyColumnWithMaxValue

func (pk *PrimaryKey) AddPrimaryKeyColumnWithMaxValue(primaryKeyName string)

Only used for range query

func (*PrimaryKey) AddPrimaryKeyColumnWithMinValue

func (pk *PrimaryKey) AddPrimaryKeyColumnWithMinValue(primaryKeyName string)

func (*PrimaryKey) Build

func (pk *PrimaryKey) Build(isDelete bool) []byte

type PrimaryKey2

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

type PrimaryKeyColumn

type PrimaryKeyColumn struct {
	ColumnName       string
	Value            interface{}
	PrimaryKeyOption PrimaryKeyOption
}

func (*PrimaryKeyColumn) String

func (this *PrimaryKeyColumn) String() string

type PrimaryKeyColumnInner

type PrimaryKeyColumnInner struct {
	Name  []byte
	Type  otsprotocol.PrimaryKeyType
	Value interface{}
}

func NewPrimaryKeyColumn

func NewPrimaryKeyColumn(name []byte, value interface{}, option PrimaryKeyOption) *PrimaryKeyColumnInner

func NewPrimaryKeyColumnAuto_Increment

func NewPrimaryKeyColumnAuto_Increment(name []byte) *PrimaryKeyColumnInner

func NewPrimaryKeyColumnINF_MAX

func NewPrimaryKeyColumnINF_MAX(name []byte) *PrimaryKeyColumnInner

func NewPrimaryKeyColumnINF_MIN

func NewPrimaryKeyColumnINF_MIN(name []byte) *PrimaryKeyColumnInner

type PrimaryKeyOption

type PrimaryKeyOption int32
const (
	NONE           PrimaryKeyOption = 0
	AUTO_INCREMENT PrimaryKeyOption = 1
	MIN            PrimaryKeyOption = 2
	MAX            PrimaryKeyOption = 3
)

type PrimaryKeySchema

type PrimaryKeySchema struct {
	Name   *string
	Type   *PrimaryKeyType
	Option *PrimaryKeyOption
}

type PrimaryKeyType

type PrimaryKeyType int32
const (
	PrimaryKeyType_INTEGER PrimaryKeyType = 1
	PrimaryKeyType_STRING  PrimaryKeyType = 2
	PrimaryKeyType_BINARY  PrimaryKeyType = 3
)

type PutRowChange

type PutRowChange struct {
	TableName     string
	PrimaryKey    *PrimaryKey
	Columns       []AttributeColumn
	Condition     *RowCondition
	ReturnType    ReturnType
	TransactionId *string
}

func (*PutRowChange) AddColumn

func (rowchange *PutRowChange) AddColumn(columnName string, value interface{})

value only support int64,string,bool,float64,[]byte. other type will get panic

func (*PutRowChange) AddColumnWithTimestamp

func (rowchange *PutRowChange) AddColumnWithTimestamp(columnName string, value interface{}, timestamp int64)

value only support int64,string,bool,float64,[]byte. other type will get panic

func (*PutRowChange) GetTableName

func (rowchange *PutRowChange) GetTableName() string

func (*PutRowChange) Serialize

func (rowchange *PutRowChange) Serialize() []byte

func (*PutRowChange) SetColumnCondition

func (rowchange *PutRowChange) SetColumnCondition(condition ColumnFilter)

func (*PutRowChange) SetCondition

func (rowchange *PutRowChange) SetCondition(rowExistenceExpectation RowExistenceExpectation)

func (*PutRowChange) SetReturnPk

func (rowchange *PutRowChange) SetReturnPk()

type PutRowRequest

type PutRowRequest struct {
	PutRowChange *PutRowChange
}

type PutRowResponse

type PutRowResponse struct {
	ConsumedCapacityUnit *ConsumedCapacityUnit
	PrimaryKey           PrimaryKey
	ResponseInfo
}

type RangeRowQueryCriteria

type RangeRowQueryCriteria struct {
	TableName       string
	StartPrimaryKey *PrimaryKey
	EndPrimaryKey   *PrimaryKey
	ColumnsToGet    []string
	MaxVersion      int32
	TimeRange       *TimeRange
	Filter          ColumnFilter
	Direction       Direction
	Limit           int32
	StartColumn     *string
	EndColumn       *string
	TransactionId   *string
}

func (*RangeRowQueryCriteria) AddColumnToGet

func (rowQueryCriteria *RangeRowQueryCriteria) AddColumnToGet(columnName string)

type RecordColumn

type RecordColumn struct {
	Type      RecordColumnType
	Name      *string     // required
	Value     interface{} // optional. present when Type is RCT_Put
	Timestamp *int64      // optional, in msec. present when Type is RCT_Put or RCT_DeleteOneVersion
}

func (*RecordColumn) String

func (this *RecordColumn) String() string

type RecordColumnType

type RecordColumnType int
const (
	RCT_Put RecordColumnType = iota
	RCT_DeleteOneVersion
	RCT_DeleteAllVersions
)

type RecordSequenceInfo

type RecordSequenceInfo struct {
	Epoch     int32
	Timestamp int64
	RowIndex  int32
}

func (*RecordSequenceInfo) String

func (this *RecordSequenceInfo) String() string

type ReservedThroughput

type ReservedThroughput struct {
	Readcap, Writecap int
}

type ResponseInfo

type ResponseInfo struct {
	RequestId string
}

type ReturnType

type ReturnType int32
const (
	ReturnType_RT_NONE         ReturnType = 0
	ReturnType_RT_PK           ReturnType = 1
	ReturnType_RT_AFTER_MODIFY ReturnType = 2
)

type Row

type Row struct {
	PrimaryKey *PrimaryKey
	Columns    []*AttributeColumn
}

type RowChange

type RowChange interface {
	Serialize() []byte

	GetTableName() string
	// contains filtered or unexported methods
}

type RowCondition

type RowCondition struct {
	RowExistenceExpectation RowExistenceExpectation
	ColumnCondition         ColumnFilter
}

type RowExistenceExpectation

type RowExistenceExpectation int
const (
	RowExistenceExpectation_IGNORE           RowExistenceExpectation = 0
	RowExistenceExpectation_EXPECT_EXIST     RowExistenceExpectation = 1
	RowExistenceExpectation_EXPECT_NOT_EXIST RowExistenceExpectation = 2
)

type RowPutChange

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

func (*RowPutChange) Build

func (rpc *RowPutChange) Build() []byte

type RowResult

type RowResult struct {
	TableName            string
	IsSucceed            bool
	Error                Error
	PrimaryKey           PrimaryKey
	Columns              []*AttributeColumn
	ConsumedCapacityUnit *ConsumedCapacityUnit
	Index                int32
}

type RowUpdateChange

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

func (*RowUpdateChange) Build

func (ruc *RowUpdateChange) Build() []byte

type SearchRequest

type SearchRequest struct {
	TableName     string
	IndexName     string
	SearchQuery   search.SearchQuery
	ColumnsToGet  *ColumnsToGet
	RoutingValues []*PrimaryKey
}

func (*SearchRequest) AddRoutingValue

func (r *SearchRequest) AddRoutingValue(routingValue *PrimaryKey) *SearchRequest

func (*SearchRequest) ProtoBuffer

func (r *SearchRequest) ProtoBuffer() (*otsprotocol.SearchRequest, error)

func (*SearchRequest) SetColumnsToGet

func (r *SearchRequest) SetColumnsToGet(columnToGet *ColumnsToGet) *SearchRequest

func (*SearchRequest) SetIndexName

func (r *SearchRequest) SetIndexName(indexName string) *SearchRequest

func (*SearchRequest) SetRoutingValues

func (r *SearchRequest) SetRoutingValues(routingValues []*PrimaryKey) *SearchRequest

func (*SearchRequest) SetSearchQuery

func (r *SearchRequest) SetSearchQuery(searchQuery search.SearchQuery) *SearchRequest

func (*SearchRequest) SetTableName

func (r *SearchRequest) SetTableName(tableName string) *SearchRequest

type SearchResponse

type SearchResponse struct {
	TotalCount   int64
	Rows         []*Row
	IsAllSuccess bool
	NextToken    []byte

	AggregationResults search.AggregationResults
	GroupByResults     search.GroupByResults

	ResponseInfo
}

type ShardId

type ShardId string

type ShardIterator

type ShardIterator string

type SingleColumnCondition

type SingleColumnCondition struct {
	Comparator        *ComparatorType
	ColumnName        *string
	ColumnValue       interface{} //[]byte
	FilterIfMissing   bool
	LatestVersionOnly bool
	TransferRule      *ValueTransferRule
}

func NewSingleColumnCondition

func NewSingleColumnCondition(columnName string, comparator ComparatorType, value interface{}) *SingleColumnCondition

func NewSingleColumnValueRegexFilter

func NewSingleColumnValueRegexFilter(columnName string, comparator ComparatorType, rule *ValueTransferRule, value interface{}) *SingleColumnCondition

func (*SingleColumnCondition) Serialize

func (condition *SingleColumnCondition) Serialize() []byte

func (*SingleColumnCondition) ToFilter

func (condition *SingleColumnCondition) ToFilter() *otsprotocol.Filter

type SingleRowQueryCriteria

type SingleRowQueryCriteria struct {
	ColumnsToGet  []string
	TableName     string
	PrimaryKey    *PrimaryKey
	MaxVersion    int32
	TimeRange     *TimeRange
	Filter        ColumnFilter
	StartColumn   *string
	EndColumn     *string
	TransactionId *string
}

func (*SingleRowQueryCriteria) AddColumnToGet

func (rowQueryCriteria *SingleRowQueryCriteria) AddColumnToGet(columnName string)

func (*SingleRowQueryCriteria) SetEndtColumn

func (rowQueryCriteria *SingleRowQueryCriteria) SetEndtColumn(columnName string)

func (*SingleRowQueryCriteria) SetFilter

func (Criteria *SingleRowQueryCriteria) SetFilter(filter ColumnFilter)

func (*SingleRowQueryCriteria) SetStartColumn

func (rowQueryCriteria *SingleRowQueryCriteria) SetStartColumn(columnName string)

type SingleWordAnalyzerParameter

type SingleWordAnalyzerParameter struct {
	CaseSensitive *bool
	DelimitWord   *bool
}

type Split

type Split struct {
	LowerBound *PrimaryKey
	UpperBound *PrimaryKey
	Location   string
}

type SplitAnalyzerParameter

type SplitAnalyzerParameter struct {
	Delimiter *string
}

type StartLocalTransactionRequest

type StartLocalTransactionRequest struct {
	PrimaryKey *PrimaryKey
	TableName  string
}

type StartLocalTransactionResponse

type StartLocalTransactionResponse struct {
	TransactionId *string
	ResponseInfo
}

type Stream

type Stream struct {
	Id           *StreamId
	TableName    *string
	CreationTime int64
}

type StreamDetails

type StreamDetails struct {
	EnableStream   bool
	StreamId       *StreamId // nil when stream is disabled.
	ExpirationTime int32     // in hours
	LastEnableTime int64     // the last time stream is enabled, in usec
}

type StreamId

type StreamId string

type StreamRecord

type StreamRecord struct {
	Type       ActionType
	Info       *RecordSequenceInfo // required
	PrimaryKey *PrimaryKey         // required
	Columns    []*RecordColumn
}

func (*StreamRecord) String

func (this *StreamRecord) String() string

type StreamShard

type StreamShard struct {
	SelfShard   *ShardId // required
	FatherShard *ShardId // optional
	MotherShard *ShardId // optional
}

* Shards are possibly splitted into two or merged from two. * After splitting, both newly generated shards have the same FatherShard. * After merging, the newly generated shard have both FatherShard and MotherShard.

type StreamSpecification

type StreamSpecification struct {
	EnableStream   bool
	ExpirationTime int32 // must be positive. in hours
}

type StreamStatus

type StreamStatus int
const (
	SS_Enabling StreamStatus = iota
	SS_Active
)

type SyncPhase

type SyncPhase int32
const (
	SyncPhase_FULL SyncPhase = 1
	SyncPhase_INCR SyncPhase = 2
)

type SyncStat

type SyncStat struct {
	SyncPhase            SyncPhase
	CurrentSyncTimestamp *int64
}

type TableMeta

type TableMeta struct {
	TableName      string
	SchemaEntry    []*PrimaryKeySchema
	DefinedColumns []*DefinedColumnSchema
}

func (*TableMeta) AddDefinedColumn

func (meta *TableMeta) AddDefinedColumn(name string, definedType DefinedColumnType)

func (*TableMeta) AddPrimaryKeyColumn

func (meta *TableMeta) AddPrimaryKeyColumn(name string, keyType PrimaryKeyType)

func (*TableMeta) AddPrimaryKeyColumnOption

func (meta *TableMeta) AddPrimaryKeyColumnOption(name string, keyType PrimaryKeyType, keyOption PrimaryKeyOption)

type TableOption

type TableOption struct {
	TimeToAlive, MaxVersion   int
	DeviationCellVersionInSec int64
}

func NewTableOption

func NewTableOption(timeToAlive int, maxVersion int) *TableOption

func NewTableOptionWithMaxVersion

func NewTableOptionWithMaxVersion(maxVersion int) *TableOption

type TableStoreApi

type TableStoreApi interface {
	CreateTable(request *CreateTableRequest) (*CreateTableResponse, error)
	ListTable() (*ListTableResponse, error)
	DeleteTable(request *DeleteTableRequest) (*DeleteTableResponse, error)
	DescribeTable(request *DescribeTableRequest) (*DescribeTableResponse, error)
	UpdateTable(request *UpdateTableRequest) (*UpdateTableResponse, error)
	PutRow(request *PutRowRequest) (*PutRowResponse, error)
	DeleteRow(request *DeleteRowRequest) (*DeleteRowResponse, error)
	GetRow(request *GetRowRequest) (*GetRowResponse, error)
	UpdateRow(request *UpdateRowRequest) (*UpdateRowResponse, error)
	BatchGetRow(request *BatchGetRowRequest) (*BatchGetRowResponse, error)
	BatchWriteRow(request *BatchWriteRowRequest) (*BatchWriteRowResponse, error)
	GetRange(request *GetRangeRequest) (*GetRangeResponse, error)

	// stream related
	ListStream(request *ListStreamRequest) (*ListStreamResponse, error)
	DescribeStream(request *DescribeStreamRequest) (*DescribeStreamResponse, error)
	GetShardIterator(request *GetShardIteratorRequest) (*GetShardIteratorResponse, error)
	GetStreamRecord(request *GetStreamRecordRequest) (*GetStreamRecordResponse, error)

	// search related
	CreateSearchIndex(request *CreateSearchIndexRequest) (*CreateSearchIndexResponse, error)
	DeleteSearchIndex(request *DeleteSearchIndexRequest) (*DeleteSearchIndexResponse, error)
	ListSearchIndex(request *ListSearchIndexRequest) (*ListSearchIndexResponse, error)
	DescribeSearchIndex(request *DescribeSearchIndexRequest) (*DescribeSearchIndexResponse, error)
	Search(request *SearchRequest) (*SearchResponse, error)
}

type TableStoreClient

type TableStoreClient struct {
	CustomizedRetryFunc CustomizedRetryNotMatterActions
	// contains filtered or unexported fields
}

@class TableStoreClient The TableStoreClient, which will connect OTS service for authorization, create/list/ delete tables/table groups, to get/put/delete a row. Note: TableStoreClient is thread-safe. TableStoreClient的功能包括连接OTS服务进行验证、创建/列出/删除表或表组、插入/获取/ 删除/更新行数据

func NewClient

func NewClient(endPoint, instanceName, accessKeyId, accessKeySecret string, options ...ClientOption) *TableStoreClient

Constructor: to create the client of TableStore service. 构造函数:创建表格存储服务的客户端。

@param endPoint The address of TableStore service. 表格存储服务地址。 @param instanceName @param accessId The Access ID. 用于标示用户的ID。 @param accessKey The Access Key. 用于签名和验证的密钥。 @param options set client config

func NewClientWithConfig

func NewClientWithConfig(endPoint, instanceName, accessKeyId, accessKeySecret string, securityToken string, config *TableStoreConfig) *TableStoreClient

Constructor: to create the client of OTS service. 传入config 构造函数:创建OTS服务的客户端。

func NewClientWithExternalHeader

func NewClientWithExternalHeader(endPoint, instanceName, accessKeyId, accessKeySecret string, securityToken string, config *TableStoreConfig, header map[string]string) *TableStoreClient

func (*TableStoreClient) AbortTransaction

func (client *TableStoreClient) AbortTransaction(request *AbortTransactionRequest) (*AbortTransactionResponse, error)

func (*TableStoreClient) AddDefinedColumn

func (tableStoreClient *TableStoreClient) AddDefinedColumn(request *AddDefinedColumnRequest) (*AddDefinedColumnResponse, error)

func (*TableStoreClient) BatchGetRow

func (tableStoreClient *TableStoreClient) BatchGetRow(request *BatchGetRowRequest) (*BatchGetRowResponse, error)

Batch Get Row @param BatchGetRowRequest

func (*TableStoreClient) BatchWriteRow

func (tableStoreClient *TableStoreClient) BatchWriteRow(request *BatchWriteRowRequest) (*BatchWriteRowResponse, error)

Batch Write Row @param BatchWriteRowRequest

func (*TableStoreClient) CommitTransaction

func (client *TableStoreClient) CommitTransaction(request *CommitTransactionRequest) (*CommitTransactionResponse, error)

func (TableStoreClient) ComputeSplitPointsBySize

func (*TableStoreClient) CreateIndex

func (tableStoreClient *TableStoreClient) CreateIndex(request *CreateIndexRequest) (*CreateIndexResponse, error)

func (*TableStoreClient) CreateSearchIndex

func (tableStoreClient *TableStoreClient) CreateSearchIndex(request *CreateSearchIndexRequest) (*CreateSearchIndexResponse, error)

func (*TableStoreClient) CreateTable

func (tableStoreClient *TableStoreClient) CreateTable(request *CreateTableRequest) (*CreateTableResponse, error)

table API Create a table with the CreateTableRequest, in which the table name and primary keys are required. 根据CreateTableRequest创建一个表,其中表名和主健列是必选项

@param request of CreateTableRequest. @return Void. 无返回值。

func (*TableStoreClient) DeleteDefinedColumn

func (tableStoreClient *TableStoreClient) DeleteDefinedColumn(request *DeleteDefinedColumnRequest) (*DeleteDefinedColumnResponse, error)

func (*TableStoreClient) DeleteIndex

func (tableStoreClient *TableStoreClient) DeleteIndex(request *DeleteIndexRequest) (*DeleteIndexResponse, error)

func (*TableStoreClient) DeleteRow

func (tableStoreClient *TableStoreClient) DeleteRow(request *DeleteRowRequest) (*DeleteRowResponse, error)

Delete row with pk @param DeleteRowRequest

func (*TableStoreClient) DeleteSearchIndex

func (tableStoreClient *TableStoreClient) DeleteSearchIndex(request *DeleteSearchIndexRequest) (*DeleteSearchIndexResponse, error)

func (*TableStoreClient) DeleteTable

func (tableStoreClient *TableStoreClient) DeleteTable(request *DeleteTableRequest) (*DeleteTableResponse, error)

Delete a table and all its views will be deleted. 删除一个表

@param tableName The table name. 表名。 @return Void. 无返回值。

func (*TableStoreClient) DescribeSearchIndex

func (tableStoreClient *TableStoreClient) DescribeSearchIndex(request *DescribeSearchIndexRequest) (*DescribeSearchIndexResponse, error)

func (*TableStoreClient) DescribeStream

func (client *TableStoreClient) DescribeStream(req *DescribeStreamRequest) (*DescribeStreamResponse, error)

func (*TableStoreClient) DescribeTable

func (tableStoreClient *TableStoreClient) DescribeTable(request *DescribeTableRequest) (*DescribeTableResponse, error)

Query the tablemeta, tableoption and reservedthroughtputdetails @param DescribeTableRequest @param DescribeTableResponse

func (*TableStoreClient) GetRange

func (tableStoreClient *TableStoreClient) GetRange(request *GetRangeRequest) (*GetRangeResponse, error)

Get Range @param GetRangeRequest

func (*TableStoreClient) GetRow

func (tableStoreClient *TableStoreClient) GetRow(request *GetRowRequest) (*GetRowResponse, error)

row API Get the data of a row or some columns.

@param getrowrequest

func (*TableStoreClient) GetShardIterator

func (client *TableStoreClient) GetShardIterator(req *GetShardIteratorRequest) (*GetShardIteratorResponse, error)

func (TableStoreClient) GetStreamRecord

func (client TableStoreClient) GetStreamRecord(req *GetStreamRecordRequest) (*GetStreamRecordResponse, error)

func (*TableStoreClient) ListSearchIndex

func (tableStoreClient *TableStoreClient) ListSearchIndex(request *ListSearchIndexRequest) (*ListSearchIndexResponse, error)

func (*TableStoreClient) ListStream

func (client *TableStoreClient) ListStream(req *ListStreamRequest) (*ListStreamResponse, error)

func (*TableStoreClient) ListTable

func (tableStoreClient *TableStoreClient) ListTable() (*ListTableResponse, error)

List all tables. If done, all table names will be returned. 列出所有的表,如果操作成功,将返回所有表的名称。

@param tableNames The returned table names. 返回的表名集合。 @return Void. 无返回值。

func (*TableStoreClient) PutRow

func (tableStoreClient *TableStoreClient) PutRow(request *PutRowRequest) (*PutRowResponse, error)

Put or update a row in a table. The operation is determined by CheckingType, which has three options: NO, UPDATE, INSERT. The transaction id is optional. 插入或更新行数据。操作针对数据的存在性包含三种检查类型:NO(不检查),UPDATE (更新,数据必须存在)和INSERT(插入,数据必须不存在)。事务ID是可选项。

@param builder The builder for putting a row. 插入或更新数据的Builder。 @return Void. 无返回值。

func (*TableStoreClient) Search

func (tableStoreClient *TableStoreClient) Search(request *SearchRequest) (*SearchResponse, error)

func (*TableStoreClient) StartLocalTransaction

func (client *TableStoreClient) StartLocalTransaction(request *StartLocalTransactionRequest) (*StartLocalTransactionResponse, error)

func (*TableStoreClient) UpdateRow

func (tableStoreClient *TableStoreClient) UpdateRow(request *UpdateRowRequest) (*UpdateRowResponse, error)

Update row @param UpdateRowRequest

func (*TableStoreClient) UpdateTable

func (tableStoreClient *TableStoreClient) UpdateTable(request *UpdateTableRequest) (*UpdateTableResponse, error)

Update the table info includes tableoptions and reservedthroughput @param UpdateTableRequest @param UpdateTableResponse

type TableStoreConfig

type TableStoreConfig struct {
	RetryTimes         uint
	MaxRetryTime       time.Duration
	HTTPTimeout        HTTPTimeout
	MaxIdleConnections int
	Transport          http.RoundTripper
}

func NewDefaultTableStoreConfig

func NewDefaultTableStoreConfig() *TableStoreConfig

type TableStoreHttpClient

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

func (*TableStoreHttpClient) Do

func (httpClient *TableStoreHttpClient) Do(req *http.Request) (*http.Response, error)

func (*TableStoreHttpClient) New

func (httpClient *TableStoreHttpClient) New(client *http.Client)

type TimeRange

type TimeRange struct {
	Start    int64
	End      int64
	Specific int64
}

type UpdateRowChange

type UpdateRowChange struct {
	TableName           string
	PrimaryKey          *PrimaryKey
	Columns             []ColumnToUpdate
	Condition           *RowCondition
	TransactionId       *string
	ReturnType          ReturnType
	ColumnNamesToReturn []string
}

func (*UpdateRowChange) AppendIncrementColumnToReturn

func (rowchange *UpdateRowChange) AppendIncrementColumnToReturn(name string)

func (*UpdateRowChange) DeleteColumn

func (rowchange *UpdateRowChange) DeleteColumn(columnName string)

func (*UpdateRowChange) DeleteColumnWithTimestamp

func (rowchange *UpdateRowChange) DeleteColumnWithTimestamp(columnName string, timestamp int64)

func (*UpdateRowChange) GetTableName

func (rowchange *UpdateRowChange) GetTableName() string

func (*UpdateRowChange) IncrementColumn

func (rowchange *UpdateRowChange) IncrementColumn(columnName string, value int64)

func (*UpdateRowChange) PutColumn

func (rowchange *UpdateRowChange) PutColumn(columnName string, value interface{})

value only support int64,string,bool,float64,[]byte. other type will get panic

func (*UpdateRowChange) PutColumnWithTimestamp

func (rowchange *UpdateRowChange) PutColumnWithTimestamp(columnName string, value interface{}, timestamp int64)

value only support int64,string,bool,float64,[]byte. other type will get panic

func (*UpdateRowChange) Serialize

func (rowchange *UpdateRowChange) Serialize() []byte

func (*UpdateRowChange) SetColumnCondition

func (rowchange *UpdateRowChange) SetColumnCondition(condition ColumnFilter)

func (*UpdateRowChange) SetCondition

func (rowchange *UpdateRowChange) SetCondition(rowExistenceExpectation RowExistenceExpectation)

func (*UpdateRowChange) SetReturnIncrementValue

func (rowchange *UpdateRowChange) SetReturnIncrementValue()

type UpdateRowRequest

type UpdateRowRequest struct {
	UpdateRowChange *UpdateRowChange
}

type UpdateRowResponse

type UpdateRowResponse struct {
	Columns              []*AttributeColumn
	ConsumedCapacityUnit *ConsumedCapacityUnit
	ResponseInfo
}

type UpdateTableRequest

type UpdateTableRequest struct {
	TableName          string
	TableOption        *TableOption
	ReservedThroughput *ReservedThroughput
	StreamSpec         *StreamSpecification
}

type UpdateTableResponse

type UpdateTableResponse struct {
	TableOption        *TableOption
	ReservedThroughput *ReservedThroughput
	StreamDetails      *StreamDetails
	ResponseInfo
}

type ValueTransferRule

type ValueTransferRule struct {
	Regex     string
	Cast_type VariantType
}

func NewValueTransferRule

func NewValueTransferRule(regex string, vt VariantType) *ValueTransferRule

type VariantType

type VariantType int32
const (
	Variant_INTEGER VariantType = 0
	Variant_DOUBLE  VariantType = 1
	//VT_BOOLEAN = 2;
	Variant_STRING VariantType = 3
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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