OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Database

KV - V4.3.5
  • OBKV overview
  • Architecture
  • OBKV-Table
    • Introduction to OBKV-Table
      • Overview
      • OBKV-Table operation types
      • Core features of OBKV-Table
      • Differences between replace and insert_or_update
      • Supported value types
      • OBKV-Table data models
    • Use the OBKV-Table Java client
      • Java development guide for OBKV-Table
      • Prepare for development with OBKV-Table
      • Use the OBKV-Table Java client to connect to a cluster
      • Set client parameters
      • Supported client interfaces
      • Use the OBKV-Table Java client
    • Use the OBKV-Table GO client
      • Use the OBKV-Table Go client to connect to a cluster
      • Overview of the Go client
      • Individual API operations
      • Batch operations
      • About queries
      • Aggregation API
      • Filters
    • FAQ
  • OBKV-HBase
    • Overview
    • OBKV-HBase core features
    • Compatibility with HBase
    • Deployment
    • Application development with OBKV-HBase
      • Overview of OBKV-HBase application development
      • Data model
      • Data model design
      • Connect to a cluster using the OBKV-HBase client
      • Migrate HBase business code to OBKV-HBase
      • Data operation examples
      • Delete expired data
    • OBKV-HBase migration guide
    • OBKV-HBase management
      • Overview
      • High availability
      • Security and permissions
      • Monitoring metrics
    • Performance test
    • OBKV-HBase integrations
      • Flink
        • Synchronize data to OBKV-HBase by using Flink
    • Views
    • FAQ

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Database
  3. KV
  4. V4.3.5

Overview of the Go client

Last Updated:2026-09-04 10:25:15

Client API
Columns

Client API

The syntax is as follows:

type Client interface {
    // Insert a record by rowKey.
    Insert(ctx context.Context, tableName string, rowKey []*table.Column, mutateColumns []*table.Column, opts ...option.ObOperationOption) (int64, error)
    // Update a record by rowKey.
    Update(ctx context.Context, tableName string, rowKey []*table.Column, mutateColumns []*table.Column, opts ...option.ObOperationOption) (int64, error)
    // InsertOrUpdate insert or update a record by rowKey.
    // insert if the primary key does not exist, update if it does.
    InsertOrUpdate(ctx context.Context, tableName string, rowKey []*table.Column, mutateColumns []*table.Column, opts ...option.ObOperationOption) (int64, error)
    // Replace a record by rowKey.
    Replace(ctx context.Context, tableName string, rowKey []*table.Column, mutateColumns []*table.Column, opts ...option.ObOperationOption) (int64, error)
    // Increment a record by rowKey.
    Increment(ctx context.Context, tableName string, rowKey []*table.Column, mutateColumns []*table.Column, opts ...option.ObOperationOption) (SingleResult, error)
    // Append a record by rowKey.
    Append(ctx context.Context, tableName string, rowKey []*table.Column, mutateColumns []*table.Column, opts ...option.ObOperationOption) (SingleResult, error)
    // Delete a record by rowKey.
    Delete(ctx context.Context, tableName string, rowKey []*table.Column, opts ...option.ObOperationOption) (int64, error)
    // Get a record by rowKey.
    Get(ctx context.Context, tableName string, rowKey []*table.Column, getColumns []string, opts ...option.ObOperationOption) (SingleResult, error)
    // Query records by rangePairs.
    Query(ctx context.Context, tableName string, rangePairs []*table.RangePair, opts ...option.ObQueryOption) (QueryResultIterator, error)
    // NewBatchExecutor create a batch executor.
    NewBatchExecutor(tableName string, opts ...option.ObBatchOption) BatchExecutor
    // NewAggExecutor create an aggregate executor.
    NewAggExecutor(tableName string, rangePairs []*table.RangePair, opts ...option.ObQueryOption) AggExecutor
    // Close closes the client.
    // close will disconnect all connections and exit all goroutines.
    Close()
}

Input parameters:

  • Insert: inserts a record.
  • Update: updates a record.
  • InsertOrUpdate: inserts a record if no primary key exists or updates a record if a primary key exists.
  • Replace: replaces a record.
  • Increment: increments specific integer columns in the record. mutateColumns specifies the delta value for increment. The value obtained after the increment can be obtained by using the func WithReturnAffectedEntity(returnAffectedEntity bool) ObkvOption method. The delta value must be of the signed type.
  • Append: appends a string to specific string columns in the record. mutateColumns specifies the delta value to be appended. The value obtained after the appending can be obtained by using the func WithReturnAffectedEntity(returnAffectedEntity bool) ObkvOption method.
  • Delete: deletes a record.
  • Get: obtains a record.
  • Query: obtains multiple records in a batch.
  • NewBatchExecutor: creates a batch executor.
  • NewAggExecutor: obtains an aggregate operation executor.
  • Close: closes the client.

Columns

A column in a table has two attributes: column name and column value.

The syntax is as follows:

type Column struct {
    name  string
    value interface{}
}

You can construct a column by using the following method:

func NewColumn(name string, value interface{}) *Column {
    return &Column{name: name, value: value}
}

Previous topic

Use the OBKV-Table Go client to connect to a cluster
Last

Next topic

Individual API operations
Next
on this page
Client API
Columns