otstype

package
v0.0.0-...-b363c71 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2017 License: MIT Imports: 4 Imported by: 3

Documentation

Overview

Base type for golang

int,rune int8 ,int16 ,int32 ,int64 byte ,uint8 ,uint16 ,uint32 ,uint64 float32 ,float64 bool string complex128,complex64

metadata for ots2

like python's type, but it's simple

Index

Constants

View Source
const (
	// OTSColumnType
	OTSColumnType_INTEGER = "INTEGER"
	OTSColumnType_STRING  = "STRING"
	OTSColumnType_BOOLEAN = "BOOLEAN"
	OTSColumnType_DOUBLE  = "DOUBLE"
	OTSColumnType_BINARY  = "BINARY"

	// OTSRowExistenceExpectation
	OTSRowExistenceExpectation_IGNORE           = "IGNORE"
	OTSRowExistenceExpectation_EXPECT_EXIST     = "EXPECT_EXIST"
	OTSRowExistenceExpectation_EXPECT_NOT_EXIST = "EXPECT_NOT_EXIST"

	OTSCondition_IGNORE           = "IGNORE"
	OTSCondition_EXPECT_EXIST     = "EXPECT_EXIST"
	OTSCondition_EXPECT_NOT_EXIST = "EXPECT_NOT_EXIST"

	// UpdateRow
	// OTSOperationType
	OTSOperationType_PUT    = "PUT"
	OTSOperationType_DELETE = "DELETE"

	// GetRange
	// OTSDirection
	OTSDirection_FORWARD  = "FORWARD"
	OTSDirection_BACKWARD = "BACKWARD"
)

Variables

This section is empty.

Functions

func GetFloat32Max

func GetFloat32Max() float32

func GetFloat32Mix

func GetFloat32Mix() float32

func GetFloat64Max

func GetFloat64Max() float64

func GetFloat64Mix

func GetFloat64Mix() float64

func GetInt16Max

func GetInt16Max() int16

func GetInt16Min

func GetInt16Min() int16

func GetInt32Max

func GetInt32Max() int32

func GetInt32Min

func GetInt32Min() int32

func GetInt8Max

func GetInt8Max() int8

func GetInt8Min

func GetInt8Min() int8

func GetUint16Max

func GetUint16Max() uint16

func GetUint16Min

func GetUint16Min() uint16

func GetUint32Max

func GetUint32Max() uint32

func GetUint32Min

func GetUint32Min() uint32

func GetUint8Max

func GetUint8Max() uint8

func GetUint8Min

func GetUint8Min() uint8

func NewBool

func NewBool(v bool) *bool

func NewComplex128

func NewComplex128(v complex128) *complex128

func NewComplex64

func NewComplex64(v complex64) *complex64

func NewFloat32

func NewFloat32(v float32) *float32

func NewFloat64

func NewFloat64(v float64) *float64

func NewInt

func NewInt(v int) *int

func NewInt16

func NewInt16(v int16) *int16

func NewInt32

func NewInt32(v int32) *int32

func NewInt64

func NewInt64(v int64) *int64

func NewInt8

func NewInt8(v int8) *int8

func NewRune

func NewRune(v rune) *rune

func NewString

func NewString(v string) *string

func NewUint16

func NewUint16(v uint16) *uint16

func NewUint32

func NewUint32(v uint32) *uint32

func NewUint64

func NewUint64(v uint64) *uint64

func NewUint8

func NewUint8(v uint8) *uint8

func Newbyte

func Newbyte(v byte) *byte

Types

type Dict

type Dict map[interface{}]interface{}

dict

func (*Dict) Add

func (d *Dict) Add(k, v interface{})

func (*Dict) Get

func (d *Dict) Get(k interface{}) (v interface{}, err error)

type DictString

type DictString map[string]interface{}

string dict

func (DictString) Del

func (d DictString) Del(key string)

delete key

func (DictString) Get

func (d DictString) Get(key string) interface{}

get value by key

func (DictString) Set

func (d DictString) Set(key string, value interface{})

set key and value to map

func (DictString) String

func (d DictString) String() string

type ListString

type ListString []TupleString

string dict, orderly dictionary

func (*ListString) Del

func (d *ListString) Del(key string)

delete key

func (*ListString) Get

func (d *ListString) Get(key string) interface{}

get value by key

func (*ListString) Set

func (d *ListString) Set(key string, value interface{})

set key and value to map

func (ListString) String

func (d ListString) String() string

type OTSAttribute

type OTSAttribute DictString

表的属性列值,精简数据模型

func (OTSAttribute) Del

func (o OTSAttribute) Del(key string)

func (OTSAttribute) Get

func (o OTSAttribute) Get(key string) interface{}

func (OTSAttribute) Set

func (o OTSAttribute) Set(key string, value interface{})

func (OTSAttribute) String

func (o OTSAttribute) String() string

type OTSBatchGetRowRequest

type OTSBatchGetRowRequest []OTSTableInBatchGetRowRequestItem

在BatchGetRow 操作中,表示要读取的多个表的请求信息

type OTSBatchGetRowResponse

type OTSBatchGetRowResponse struct {
	Tables []*OTSTableInBatchGetRowResponseItem
}

对应了每个 table 下读取到的数据。 响应消息中 OTSTableInBatchGetRowResponseItem 对象的顺序与 OTSBatchGetRowRequest 中的 OTSTableInBatchGetRowRequestItem 对象的顺序相同;每个 OTSTableInBatchGetRowResponseItem 下面的 OTSRowInBatchGetRowResponseItem 对象的顺序与 OTSTableInBatchGetRowRequestItem 下面的 Rows 相同。 如果某行不存在或者某行在指定的 ColumnsToGet 下没有数据,仍然会在 OTSTableInBatchGetRowResponseItem 中有一条对应的 OTSRowInBatchGetRowResponseItem,但其 Row 下面的 PrimaryKeyColumns 和 AttributeColumns 将为空。

若某行读取失败,该行所对应的 OTSRowInBatchGetRowResponseItem 中 IsOk 将为 false,此时 Row 将为空。

注意: BatchGetRow 操作可能会在行级别部分失败,此时返回的 HTTP 状态码仍为200。应用 程序必须对 OTSRowInBatchGetRowResponseItem 中的error 进行检查确认每一行的执行结果,并进行相 应的处理。

服务能力单元消耗: 如果本次操作整体失败,不消耗任何服务能力单元。 如果请求超时,结果未定义,服务能力单元有可能被消耗,也可能未被消耗。 其他情况将每个 OTSRowInBatchGetRowResponseItem 视为一个 OTSGetRow 操作独立计算读服务能力单 元。

func (*OTSBatchGetRowResponse) GetTables

type OTSBatchWriteRowRequest

type OTSBatchWriteRowRequest []OTSTableInBatchWriteRowRequestItem

在BatchWriteRow 操作中,表示要写入的多个表的请求信息

type OTSBatchWriteRowResponse

type OTSBatchWriteRowResponse struct {
	Tables []*OTSTableInBatchWriteRowResponseItem
}

对应了每个 table 下各操作的响应信息,包括是否成功执行,错误码和消耗的服务能力单元。 响应消息中 OTSTableInBatchWriteRowResponseItem 对象的顺序与 OTSBatchWriteRowRequest 中的 OTSTableInBatchWriteRowRequestItem 对象的顺序相同;每个 OTSTableInBatchWriteRowRequestItem 中 PutRows、UpdateRows、DeleteRows 包含的OTSRowInBatchWriteRowResponseItem 对象的顺序分别与 OTSTableInBatchWriteRowRequestItem 中 PutRows、UpdateRows、DeleteRows 包含的 OTSPutRowItem, OTSUpdateRowItem 和 OTSDeleteRowItem 对象的顺序相同。

若某行读取失败,该行所对应的 OTSRowInBatchWriteRowResponseItem 中 IsOk 将为false。

注意:BatchWriteRow 操作可能会在行级别部分失败,此时返回的HTTP 状态码仍为200。应 用程序必须对 OTSRowInBatchWriteRowResponseItem 中的 error 进行检查,确认每一行的执行结果并进 行相应的处理。

服务能力单元消耗: 如果本次操作整体失败,不消耗任何服务能力单元。 如果请求超时,结果未定义,服务能力单元有可能被消耗,也可能未被消耗。 其他情况将每个 OTSPutRowItem、OTSUpdateRowItem、OTSDeleteRowItem 依次视作相对应的写操作独立计算读服务能力单元。

func (*OTSBatchWriteRowResponse) GetTables

type OTSCapacityUnit

type OTSCapacityUnit struct {
	// 本次操作消耗的读服务能力单元或该表的读服务能力单元
	Read int32
	// 本次操作消耗的写服务能力单元或该表的写服务能力单元
	Write int32
}

表示一次操作消耗服务能力单元的值或是一个表的预留读写吞吐量的值

func (*OTSCapacityUnit) GetRead

func (o *OTSCapacityUnit) GetRead() int32

获取本次操作消耗的读服务能力单元或该表的读服务能力单元

func (*OTSCapacityUnit) GetWrite

func (o *OTSCapacityUnit) GetWrite() int32

获取本次操作消耗的写服务能力单元或该表的写服务能力单元

type OTSColumnsToDelete

type OTSColumnsToDelete []string

在数据更新时,指定数据行中哪些属性列需要删除

type OTSColumnsToGet

type OTSColumnsToGet []string

在数据读取时,指定数据行中哪些属性列需要读取

type OTSColumnsToPut

type OTSColumnsToPut DictString

在数据更新时,指定数据行中哪些属性列需要更新

type OTSDeleteRowItem

type OTSDeleteRowItem struct {
	Condition  string
	PrimaryKey OTSPrimaryKey
}

删除行对象

type OTSDeleteRowResponse

type OTSDeleteRowResponse struct {
	// 消耗的读服务能力单元或该表的读服务能力单元
	Consumed *OTSCapacityUnit
}

删除一行数据

func (*OTSDeleteRowResponse) GetWriteConsumed

func (o *OTSDeleteRowResponse) GetWriteConsumed() int32

type OTSDeleteRows

type OTSDeleteRows []OTSDeleteRowItem

type OTSDescribeTableResponse

type OTSDescribeTableResponse struct {
	// 该表的Schema,与建表时给出的Schema 相同
	TableMeta *OTSTableMeta
	// 该表的预留读写吞吐量设置信息,除了包含当前的预留读写吞吐量设置值之外,还包含了
	// 最近一次更新该表的预留读写吞吐量设置的时间和当日已下调预留读写吞吐量的次数。
	ReservedThroughputDetails *OTSReservedThroughputDetails
}

查询指定表的结构信息和预留读写吞吐量设置信息服务器响应

type OTSGetRangeResponse

type OTSGetRangeResponse struct {
	// 该行操作消耗的服务能力单元
	Consumed *OTSCapacityUnit
	// 本次GetRange 操作的断点信息
	// 若为空,则本次GetRange 的响应消息中已包含了请求范围内的所有数据
	// 若不为空, 则表示本次GetRange 的响应消息中只包含了[inclusive_start_primary_key,
	// next_start_primary_key) 间的数据,若需要剩下的数据,需要将next_start_primary_key 作为inclusive_
	// start_primary_key,原始请求中的exclusive_end_primary_key 作为exclusive_end_primary_key
	// 继续执行GetRange 操作。
	// 注意:OTS 系统中限制了GetRange 操作的响应消息中数据不超过5000 行,大小不超过1M。
	// 即使在GetRange 请求中未设定limit,在响应中仍可能出现next_start_primary_key。因此在使用
	// GetRange 时一定要对响应中是否有next_start_primary_key 进行处理。
	NextStartPrimaryKey OTSPrimaryKey
	// 读取到的所有数据,若请求中direction 为FORWARD,则所有行按照主键由小到大进行排
	// 序;若请求中direction 为BACKWARD,则所有行按照主键由大到小进行排序
	// 其中每行的primary_key_columns 和attribute_columns 均只包含在columns_to_get 中指定的
	// 列,其顺序不保证与request 中的columns_to_get 一致;primary_key_columns 的顺序亦不保证与
	// 建表时指定的顺序一致。
	// 如果请求中指定的columns_to_get 不含有任何主键列,那么其主键在查询范围内,但没有任
	// 何一个属性列在columns_to_get 中的行将不会出现在响应消息里。
	Rows OTSRows
}

本次GetRange 操作的服务器反馈

服务能力单元消耗: GetRange 操作消耗读服务能力单元的数值为查询范围内所有行数据大小除以1KB 向上取 整。关于数据大小的计算请参见相关章节。 如果请求超时,结果未定义,服务能力单元有可能被消耗,也可能未被消耗。 如果返回内部错误(HTTP 状态码:5XX),则此次操作不消耗服务能力单元,其他错误情况 消耗1 读服务能力单元。

func (*OTSGetRangeResponse) GetNextStartPrimaryKey

func (o *OTSGetRangeResponse) GetNextStartPrimaryKey() OTSPrimaryKey

func (*OTSGetRangeResponse) GetReadConsumed

func (o *OTSGetRangeResponse) GetReadConsumed() int32

func (*OTSGetRangeResponse) GetRows

func (o *OTSGetRangeResponse) GetRows() OTSRows

type OTSGetRowResponse

type OTSGetRowResponse struct {
	// 消耗的读服务能力单元或该表的读服务能力单元
	Consumed *OTSCapacityUnit
	// 行数据,包含了主键列和属性列
	Row *OTSRow
}

获取一行数据

func (*OTSGetRowResponse) GetAttributeColumns

func (o *OTSGetRowResponse) GetAttributeColumns() OTSAttribute

func (*OTSGetRowResponse) GetReadConsumed

func (o *OTSGetRowResponse) GetReadConsumed() int32

type OTSListTableResponse

type OTSListTableResponse struct {
	TableNames []string
}

表示一个OTS实例下的表的列表

type OTSPrimaryKey

type OTSPrimaryKey DictString

表的主键列值,精简数据模型

func (OTSPrimaryKey) Del

func (o OTSPrimaryKey) Del(key string)

func (OTSPrimaryKey) Get

func (o OTSPrimaryKey) Get(key string) interface{}

func (OTSPrimaryKey) Set

func (o OTSPrimaryKey) Set(key string, value interface{})

func (OTSPrimaryKey) String

func (o OTSPrimaryKey) String() string

type OTSPrimaryKeyRows

type OTSPrimaryKeyRows []OTSPrimaryKey

表的多行主键列值,精简数据模型

type OTSPutRowItem

type OTSPutRowItem struct {
	Condition        string
	PrimaryKey       OTSPrimaryKey
	AttributeColumns OTSAttribute
}

创建行对象

type OTSPutRowResponse

type OTSPutRowResponse struct {
	// 消耗的读服务能力单元或该表的读服务能力单元
	Consumed *OTSCapacityUnit
}

插入一行数据

func (*OTSPutRowResponse) GetWriteConsumed

func (o *OTSPutRowResponse) GetWriteConsumed() int32

type OTSPutRows

type OTSPutRows []OTSPutRowItem

表的多行操作集合,精简数据模型

type OTSReservedThroughput

type OTSReservedThroughput struct {
	// 表当前的预留读写吞吐量数值
	CapacityUnit OTSCapacityUnit
}

表示一个表设置的预留读写吞吐量数值

type OTSReservedThroughputDetails

type OTSReservedThroughputDetails struct {
	// 该表的预留读写吞吐量的数值
	CapacityUnit *OTSCapacityUnit
	// 最近一次上调该表的预留读写吞吐量设置的时间,使用UTC 秒数表示
	LastIncreaseTime time.Time
	// 最近一次下调该表的预留读写吞吐量设置的时间,使用UTC 秒数表示
	LastDecreaseTime time.Time
	// 一个自然日内已下调该表的预留读写吞吐量设置的次数
	NumberOfDecreasesToday int32
}

表示一个表的预留读写吞吐量信息

type OTSRow

type OTSRow struct {
	// 主键列
	PrimaryKeyColumns OTSPrimaryKey
	// 属性列
	AttributeColumns OTSAttribute
}

一行数据的主键列和属性列

func (*OTSRow) GetAttributeColumns

func (o *OTSRow) GetAttributeColumns() OTSAttribute

func (*OTSRow) GetPrimaryKeyColumns

func (o *OTSRow) GetPrimaryKeyColumns() OTSPrimaryKey

func (*OTSRow) String

func (o *OTSRow) String() string

type OTSRowInBatchGetRowResponseItem

type OTSRowInBatchGetRowResponseItem struct {
	// 该行操作是否成功。若为true,则该行读取成功,error 无效;若为false,则该行读取失败,row 无效
	IsOk bool
	// 该行操作的错误号
	ErrorCode string
	// 该行操作的错误信息
	ErrorMessage string
	// 该行操作消耗的服务能力单元
	Consumed *OTSCapacityUnit
	// 行数据,包含了主键列和属性列
	Row *OTSRow
}

在BatchGetRow 操作的返回消息中,表示一行数据。

func (*OTSRowInBatchGetRowResponseItem) GetErrorCode

func (o *OTSRowInBatchGetRowResponseItem) GetErrorCode() string

func (*OTSRowInBatchGetRowResponseItem) GetErrorMessage

func (o *OTSRowInBatchGetRowResponseItem) GetErrorMessage() string

func (*OTSRowInBatchGetRowResponseItem) GetReadConsumed

func (o *OTSRowInBatchGetRowResponseItem) GetReadConsumed() int32

func (*OTSRowInBatchGetRowResponseItem) GetRow

type OTSRowInBatchWriteRowResponseItem

type OTSRowInBatchWriteRowResponseItem struct {
	// 该行操作是否成功。若为true,则该行写入成功,error 无效;若为false,则该行写入失败。
	IsOk bool
	// 该行操作的错误号
	ErrorCode string
	// 该行操作的错误信息
	ErrorMessage string
	// 该行操作消耗的服务能力单元
	Consumed *OTSCapacityUnit
}

在 BatchWriteRow 操作的返回消息中,表示一行写入操作的结果。

func (*OTSRowInBatchWriteRowResponseItem) GetErrorCode

func (o *OTSRowInBatchWriteRowResponseItem) GetErrorCode() string

func (*OTSRowInBatchWriteRowResponseItem) GetErrorMessage

func (o *OTSRowInBatchWriteRowResponseItem) GetErrorMessage() string

func (*OTSRowInBatchWriteRowResponseItem) GetWriteConsumed

func (o *OTSRowInBatchWriteRowResponseItem) GetWriteConsumed() int32

type OTSRows

type OTSRows []*OTSRow

多行数据

type OTSSchemaOfPrimaryKey

type OTSSchemaOfPrimaryKey ListString

表主键列描述

func (*OTSSchemaOfPrimaryKey) Del

func (o *OTSSchemaOfPrimaryKey) Del(key string)

func (*OTSSchemaOfPrimaryKey) Get

func (o *OTSSchemaOfPrimaryKey) Get(key string) interface{}

func (*OTSSchemaOfPrimaryKey) Set

func (o *OTSSchemaOfPrimaryKey) Set(key string, value interface{})

type OTSTableInBatchGetRowRequestItem

type OTSTableInBatchGetRowRequestItem struct {
	// 该表的表名
	TableName string
	// 该表中需要读取的全部行的信息
	Rows OTSPrimaryKeyRows
	// 该表中需要返回的全部列的列名
	ColumnsToGet OTSColumnsToGet
}

在BatchGetRow 操作中,表示要读取的一个表的请求信息

type OTSTableInBatchGetRowResponseItem

type OTSTableInBatchGetRowResponseItem struct {
	// 该表的表名
	TableName string
	// 该表中读取到的全部行数据
	Rows []*OTSRowInBatchGetRowResponseItem
}

在 BatchGetRow 操作的返回消息中,表示一个表的数据。

func (*OTSTableInBatchGetRowResponseItem) GetRows

func (*OTSTableInBatchGetRowResponseItem) GetTableName

func (o *OTSTableInBatchGetRowResponseItem) GetTableName() string

type OTSTableInBatchWriteRowRequestItem

type OTSTableInBatchWriteRowRequestItem struct {
	// 该表的表名
	TableName string
	// 该表中需要写入的全部行的信息
	PutRows OTSPutRows
	// 该表中需要更新的全部行的信息
	UpdateRows OTSUpdateRows
	// 该表中需要删除的全部行的信息
	DeleteRows OTSDeleteRows
}

在BatchWriteRow 操作中,表示要写入的一个表的请求信息

type OTSTableInBatchWriteRowResponseItem

type OTSTableInBatchWriteRowResponseItem struct {
	// 该表的表名
	TableName string
	// 该表中PutRow 操作的结果
	PutRows []*OTSRowInBatchWriteRowResponseItem
	// 该表中UpdateRow 操作的结果
	UpdateRows []*OTSRowInBatchWriteRowResponseItem
	// 该表中DeleteRow 操作的结果
	DeleteRows []*OTSRowInBatchWriteRowResponseItem
}

在 BatchWriteRow 操作中,表示对一个表进行写入的结果。

func (*OTSTableInBatchWriteRowResponseItem) GetDeleteRows

func (*OTSTableInBatchWriteRowResponseItem) GetPutRows

func (*OTSTableInBatchWriteRowResponseItem) GetTableName

func (o *OTSTableInBatchWriteRowResponseItem) GetTableName() string

func (*OTSTableInBatchWriteRowResponseItem) GetUpdateRows

type OTSTableMeta

type OTSTableMeta struct {
	// 该表的表名
	TableName string
	// 该表全部的主键列描述
	SchemaOfPrimaryKey OTSSchemaOfPrimaryKey
}

表示一个表的结构信息

type OTSUpdateOfAttribute

type OTSUpdateOfAttribute DictString

表更新属性列值,精简数据模型

func (OTSUpdateOfAttribute) Del

func (o OTSUpdateOfAttribute) Del(key string)

func (OTSUpdateOfAttribute) Get

func (o OTSUpdateOfAttribute) Get(key string) interface{}

func (OTSUpdateOfAttribute) Set

func (o OTSUpdateOfAttribute) Set(key string, value interface{})

func (OTSUpdateOfAttribute) String

func (o OTSUpdateOfAttribute) String() string

type OTSUpdateRowItem

type OTSUpdateRowItem struct {
	Condition                string
	PrimaryKey               OTSPrimaryKey
	UpdateOfAttributeColumns OTSUpdateOfAttribute
}

更新行对象

type OTSUpdateRowResponse

type OTSUpdateRowResponse struct {
	// 消耗的读服务能力单元或该表的读服务能力单元
	Consumed *OTSCapacityUnit
}

更新一行数据

func (*OTSUpdateRowResponse) GetWriteConsumed

func (o *OTSUpdateRowResponse) GetWriteConsumed() int32

type OTSUpdateRows

type OTSUpdateRows []OTSUpdateRowItem

type OTSUpdateTableResponse

type OTSUpdateTableResponse struct {
	// 更新后该表的预留读写吞吐量设置信息,除了包含当前的预留读写吞吐量设置值之外,还
	// 包含了最近一次更新该表的预留读写吞吐量设置的时间和当日已下调预留读写吞吐量的次数
	ReservedThroughputDetails *OTSReservedThroughputDetails
}

更新指定表的读服务能力单元或写服务能力单元设置,(新设定将于更新成功一分钟内生效)服务器响应

tip:

调整每个表预留读写吞吐量的最小时间间隔为10 分钟,如果本次UpdateTable 操作距上次
不到10 分钟将被拒绝。
每个自然日(UTC 时间00:00:00 到第二天的00:00:00) 内每个表上调预留读写吞吐量次数不
限,但下调预留读写吞吐量次数不能超过4 次。下调写服务能力单元或者读服务能力单元其中
之一即视为下调预留读写吞吐量

type OTS_INF_MAX

type OTS_INF_MAX struct {
}

only for GetRange

var OTSColumnType_INF_MAX OTS_INF_MAX // only for GetRange

type OTS_INF_MIN

type OTS_INF_MIN struct {
}

only for GetRange

var OTSColumnType_INF_MIN OTS_INF_MIN // only for GetRange

type Tuple

type Tuple []struct {
	K interface{}
	V interface{}
}

tuple

type TupleString

type TupleString struct {
	K string
	V interface{}
}

string tuple

func (*TupleString) GetKey

func (t *TupleString) GetKey() string

func (TupleString) GetName

func (t TupleString) GetName() string

for OTS protobuf adapter

func (TupleString) GetType

func (t TupleString) GetType() interface{}

func (*TupleString) GetValue

func (t *TupleString) GetValue() interface{}

func (*TupleString) SetKey

func (t *TupleString) SetKey(k string)

func (*TupleString) SetValue

func (t *TupleString) SetValue(v interface{})

Jump to

Keyboard shortcuts

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