Documentation ¶
Index ¶
- Variables
- func CheckModel(obj interface{}) error
- func CreateIndexSchema(obj interface{}) ([]*tablestore.FieldSchema, error)
- func EnsureID(obj interface{}) (string, error)
- func GetBatchWriteResult(resp *tablestore.BatchWriteRowResponse) error
- func GetDeleteRowChange(obj interface{}) (*tablestore.DeleteRowChange, error)
- func GetFieldNameMap(obj interface{}) (map[string]string, map[string]string, error)
- func GetSaveRowChange(obj interface{}) (*tablestore.PutRowChange, error)
- func GetTableName(obj interface{}) string
- func LoadData(obj interface{}, row *tablestore.Row) error
- type DB
- func (db *DB) AutoMigrate(models ...interface{})
- func (db *DB) Count(num *int) error
- func (db *DB) CreateIndex(obj interface{}) error
- func (db *DB) CreateTable(obj interface{}) error
- func (db *DB) Delete(objList ...interface{}) error
- func (db *DB) DeleteIndex(obj interface{}) error
- func (db *DB) DeleteTable(obj interface{}) error
- func (db *DB) Find(obj interface{}) error
- func (db *DB) FindByToken(obj interface{}, token []byte) (nextToken []byte, err error)
- func (db *DB) First(obj interface{}) error
- func (db *DB) Limit(n int) *DB
- func (db *DB) Offset(n int) *DB
- func (db *DB) Query(queries ...search.Query) *DB
- func (db *DB) Save(objList ...interface{}) ([]interface{}, error)
- func (db *DB) SortByField(field string, asc bool) *DB
- func (db *DB) SortByGeoDistance(field string, points []string) *DB
- func (db *DB) SortByPrimaryKey(asc bool) *DB
- func (db *DB) SortByScore(asc bool) *DB
- func (db *DB) Token(token []byte) *DB
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CreateIndexSchema ¶
func CreateIndexSchema(obj interface{}) ([]*tablestore.FieldSchema, error)
func GetBatchWriteResult ¶
func GetBatchWriteResult(resp *tablestore.BatchWriteRowResponse) error
判断是否部分失败,一般概率较小,因为所有请求都是统一格式的且为Ignore,不容易有这种错误 但是一旦发生不好排查,因为pk是空的,无法确认是那个对象失败了
func GetDeleteRowChange ¶
func GetDeleteRowChange(obj interface{}) (*tablestore.DeleteRowChange, error)
func GetFieldNameMap ¶
func GetSaveRowChange ¶
func GetSaveRowChange(obj interface{}) (*tablestore.PutRowChange, error)
func GetTableName ¶
func GetTableName(obj interface{}) string
func LoadData ¶
func LoadData(obj interface{}, row *tablestore.Row) error
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func NewDB ¶
func NewDB(endPoint, instanceName, accessKeyId, accessKeySecret string, options ...tablestore.ClientOption) *DB
func (*DB) CreateIndex ¶
根据tag创建索引,默认所有字段都创建对应类型的索引,可以通过index tag覆盖默认
func (*DB) CreateTable ¶
创建表,表名为结构体小写,主键约定为 _id string
func (*DB) DeleteIndex ¶
func (*DB) FindByToken ¶
func (*DB) SortByPrimaryKey ¶
func (*DB) SortByScore ¶
Click to show internal directories.
Click to hide internal directories.