engine

package
v0.0.0-...-1e5e0da Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package engine 存储引擎

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine 存储引擎管理器

全库唯一常住内存对象,并持有所有库的句柄

API 入口

存储格式 {dataDir}/Data/{dataName}/{formName}/{formName}.dat/idx...

func Obtain

func Obtain() *Engine

Obtain 获取表引擎

func (*Engine) Databases

func (e *Engine) Databases() []*api.Database

Databases 获取数据库集合

func (*Engine) Del

func (e *Engine) Del(databaseName, formName, key string) (interface{}, error)

Del 删除数据

databaseID 数据库名

formName 表名

key 指定的key

返回 删除的数据对象

func (*Engine) Delete

func (e *Engine) Delete(databaseName, formName string, selectorBytes []byte) (count int32, err error)

Delete 根据条件删除

databaseID 数据库名

formName 表名

selectorBytes 选择器字节数组,自定义转换策略

return count 删除结果总条数

return err 删除错误信息,如果有

func (*Engine) Forms

func (e *Engine) Forms(databaseName string) []*api.Form

Forms 根据数据库名获取表集合

func (*Engine) Get

func (e *Engine) Get(databaseName, formName, key string) (interface{}, error)

Get 获取数据

databaseID 数据库名

formName 表名

key 指定的key

返回 获取的数据对象

func (*Engine) Insert

func (e *Engine) Insert(databaseName, formName string, value interface{}) (uint64, error)

Insert 新增数据

databaseID 数据库名

formName 表名

value 插入数据对象

返回 hashKey

func (*Engine) NewDatabase

func (e *Engine) NewDatabase(databaseName, comment string) error

NewDatabase 新建数据库

新建数据库会同时创建一个名为_default的表,未指定表明的情况下使用put/get等方法会操作该表

databaseName 数据库名称

comment 数据库描述

func (*Engine) NewForm

func (e *Engine) NewForm(databaseName, formName, comment string, formType api.FormType) error

NewForm 新建表,会创建默认自增主键

databaseName 数据库名

formName 表名称

comment 表描述

formType 表类型

func (*Engine) Put

func (e *Engine) Put(databaseName, formName, key string, value interface{}) (uint64, error)

Put 新增数据

databaseID 数据库名

formName 表名

key 插入的key

value 插入数据对象

返回 hashKey

func (*Engine) Select

func (e *Engine) Select(databaseName, formName string, selectorBytes []byte) (count int32, values []interface{}, err error)

Select 根据条件检索

databaseID 数据库名

formName 表名

selectorBytes 选择器字节数组,自定义转换策略

return count 检索结果总条数

return values 检索结果集合

return err 检索错误信息,如果有

func (*Engine) Set

func (e *Engine) Set(databaseName, formName, key string, value interface{}) (uint64, error)

Set 新增或修改数据

databaseID 数据库名

formName 表名

key 插入的key

value 插入数据对象

返回 hashKey

func (*Engine) Update

func (e *Engine) Update(databaseName, formName string, value interface{}) (uint64, error)

Update 更新数据,如果存在数据,则更新,如不存在,则插入

databaseID 数据库名

formName 表名

value 插入数据对象

返回 hashKey

Directories

Path Synopsis
Package dsiam 文档静态索引存取方法(document static index access method)
Package dsiam 文档静态索引存取方法(document static index access method)
Package msiam 内存静态索引存取方法(memory static index access method)
Package msiam 内存静态索引存取方法(memory static index access method)
Package siam 静态索引方法(static index access method)
Package siam 静态索引方法(static index access method)
index
Package index 数据库存取方法,包含富查询条件选择器
Package index 数据库存取方法,包含富查询条件选择器
storage
Package storage 数据真实存储操作
Package storage 数据真实存储操作

Jump to

Keyboard shortcuts

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