Documentation
¶
Index ¶
- Constants
- func BuildTableStoreEndpoint(instanceName, area, mode string) (string, error)
- func BuildUpdateRowChange(table string, pk *tablestore.PrimaryKey, mut *UpdateMutation, ...) (*tablestore.UpdateRowChange, error)
- func ConvertTablesConfig(cfg *config.TablesConfig) (map[string]*TableConfig, error)
- func DefaultTablesConfigPath() string
- func NewPrimaryKey(entries ...PKEntry) *tablestore.PrimaryKey
- func PrepareRowMapForTableStore(data map[string]interface{}) (map[string]interface{}, error)
- func PrimaryKeyToMap(pk *tablestore.PrimaryKey) map[string]interface{}
- func RowMapFromTableStore(raw map[string]interface{}) map[string]interface{}
- func SetDefaultRetryConfig(cfg RetryConfig)
- func SyncTableStoreEndpoint(instanceName string) (string, error)
- type BatchGetRowItem
- type Client
- type ColumnVersionDelete
- type GetRangeOptions
- type GetRangePage
- type GetRowOptions
- type Operator
- type Option
- type PKEntry
- type RetryConfig
- type SimpleTableOperator
- type TableConfig
- type UpdateMutation
Constants ¶
const ( // EndpointModeDevelopment 表示开发模式:使用公网 endpoint。 EndpointModeDevelopment = "development" // EndpointModeProduction 表示生产模式:使用 VPC endpoint。 EndpointModeProduction = "production" )
Variables ¶
This section is empty.
Functions ¶
func BuildTableStoreEndpoint ¶
BuildTableStoreEndpoint 根据实例名、区域与运行模式拼接 TableStore endpoint。 供同步工具等场景与 SDK 内部共用,规则与 New 系列一致。
func BuildUpdateRowChange ¶
func BuildUpdateRowChange(table string, pk *tablestore.PrimaryKey, mut *UpdateMutation, cond *tablestore.RowCondition) (*tablestore.UpdateRowChange, error)
BuildUpdateRowChange 由 UpdateMutation 生成 UpdateRowChange,可与 BatchWriteRowChanges 组合使用。
func ConvertTablesConfig ¶
func ConvertTablesConfig(cfg *config.TablesConfig) (map[string]*TableConfig, error)
ConvertTablesConfig 将 config 包中的 YAML 结构转换为运行时表配置。 转换过程中会校验字段类型是否合法,确保错误尽早暴露在初始化阶段。
func DefaultTablesConfigPath ¶
func DefaultTablesConfigPath() string
DefaultTablesConfigPath 返回默认配置路径。 解析顺序: 1. 优先读取环境变量 SIMPLEOTSGO_TABLES_PATH; 2. 未设置时回落到当前工作目录下的 config/tables.yaml。
func NewPrimaryKey ¶
func NewPrimaryKey(entries ...PKEntry) *tablestore.PrimaryKey
NewPrimaryKey 按表定义顺序构造 *tablestore.PrimaryKey。
func PrepareRowMapForTableStore ¶
PrepareRowMapForTableStore 写入前编码 *_json 列(与 PutRow 行为一致,供直连底层 SDK 时使用)。
func PrimaryKeyToMap ¶
func PrimaryKeyToMap(pk *tablestore.PrimaryKey) map[string]interface{}
PrimaryKeyToMap 将 PrimaryKey 转为 map(无序;续扫分页请使用 *tablestore.PrimaryKey)。
func RowMapFromTableStore ¶
RowMapFromTableStore 将含 *_json 字符串列的 map 解析为嵌套 map/slice(与 GetRow 系列行为一致)。
func SetDefaultRetryConfig ¶
func SetDefaultRetryConfig(cfg RetryConfig)
SetDefaultRetryConfig 设置全局重试配置。
func SyncTableStoreEndpoint ¶
SyncTableStoreEndpoint 解析同步工具连接用的 endpoint。 若已设置 TABLESTORE_ENDPOINT,则全实例共用该地址(多实例 YAML 时请慎用); 否则按 instanceName + TABLESTORE_AREA + 运行模式自动拼接。
Types ¶
type BatchGetRowItem ¶
type BatchGetRowItem = core.BatchGetRowItem
type ColumnVersionDelete ¶
type ColumnVersionDelete = core.ColumnVersionDelete
type GetRangeOptions ¶
type GetRangeOptions = core.GetRangeOptions
type GetRangePage ¶
type GetRangePage = core.GetRangePage
type GetRowOptions ¶
type GetRowOptions = core.GetRowOptions
GetRowOptions、BatchGetRowItem、GetRangeOptions、GetRangePage 等为行级读写可选参数与结果类型。
type Operator ¶
type Operator struct {
// contains filtered or unexported fields
}
Operator 是面向业务层的简化入口。 设计目标是只要求 AccessKey/SecretKey,表结构与实例信息由 tables.yaml 决定。
func New ¶
New 创建最简 SDK 操作入口。 1. 自动加载 tables.yaml(只执行一次); 2. 自动读取 TABLESTORE_ENDPOINT; 3. 返回可按表名获取操作器的 Operator。
func NewWithConfig ¶
NewWithConfig 创建可完全自定义初始化参数的入口。 tablesPath 为空时会走 DefaultTablesConfigPath;不为空时优先使用传入路径。
func NewWithEndpoint ¶
NewWithEndpoint 在代码中显式指定 endpoint。 当调用方不想依赖环境变量时,建议使用该函数。
type SimpleTableOperator ¶
type SimpleTableOperator = core.SimpleTableOperator
SimpleTableOperator 对外暴露操作器类型,保持与核心实现一致。
type UpdateMutation ¶
type UpdateMutation = core.UpdateMutation
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
sync_tables
command
incremental_push 实现推送模式下「表已存在」时的增量 DDL: 在不动主键、不删列的前提下,用 AddDefinedColumn 补齐本地 YAML 中多出的预定义列。
|
incremental_push 实现推送模式下「表已存在」时的增量 DDL: 在不动主键、不删列的前提下,用 AddDefinedColumn 补齐本地 YAML 中多出的预定义列。 |