resob

package module
v0.0.0-...-5b7b5e4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MulanPSL-2.0 Imports: 26 Imported by: 0

README

resob

██████╗ ███████╗███████╗ ██████╗ ██████╗ 
██╔══██╗██╔════╝██╔════╝██╔═══██╗██╔══██╗
██████╔╝█████╗  ███████╗██║   ██║██████╔╝
██╔══██╗██╔══╝  ╚════██║██║   ██║██╔══██╗
██║  ██║███████╗███████║╚██████╔╝██████╔╝
╚═╝  ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═════╝ 
介绍

resob是remote service of BsTr tree的缩写。包resob定义了一个名为BsTr的结构,并基于该结构实现了一个可以指针混写的类B+树,借鉴脉动工作流模式,支持表级并行度。纯go标准库实现,没有额外的依赖。 resob_jsondb是基于BsTr树的json数据库,支持特定的json格式作为包含数据的操作命令,通过解析json实现插入、删除、更新和查找。

特性
  1. 具有在go结构体和BsTr struct之间实施相互转换的能力;具备在BsTr struct和json字符串之间实施序列化和反序列化的能力。
  2. 具备基于BsTr struct简捷生成BsTr tree(blink tree)的能力;BsTr tree可以在内存块和磁盘page间实施指针混写。
  3. BsTr tree支持5中key([]byte、string、int64,、float64、complex128)任意value的插入、删除、更新和查找(具备服务端分页能力),可以分为单线程和多线程模式工作,具备表级并行。
  4. BsTr tree支持UNIQUE、COMPRESS、FILE、BIG、FILEBIG、NOSERIAL等key标识。
  5. resob_jsondt基于BsTr tree,实现了两种key类型(string、int64)value为json数据的插入、删除、更新和查找(具备服务端分页能力),json的字段会被分别存储并建立索引。
  6. resob_jsondb是基于resob_jsondt实现的json解析数据库,可以很容易地实现为提供远程json解析数据存储或缓存服务。resob-http-simpleadmin是基于resobdb的一个demo实现,包含服务端及管理界面,所有的操作采用json格式的命令,通过http发送和接收数据。
安装教程
  1. go install gitee.com/lineofsight/resob
  2. 直接打包下载解压,然后在项目中import

一个退役中校教你如何用go语言写一个基于B+树的json数据库

json命令示例
  • {"showdbs":""}
  • {"use":{"db":"info-energizer","remotelog":"127.0.0.1:9527","readonly":false,"usr":"resob","pwd":"jsonany"}}
  • {"updpwd":{"usr":"resob","pwd":"anyjson"}}
  • {"showdts":"info-energizer"}
  • {"get":{"personal_info":"{*}","fields":"[*]"}}
  • {"page":"next"}/{"page":"prev"}/{"page":200}
  • {"get":{"family_name:personal_info":"{~}","fields":"[personal_info.family_name,personal_info.name]"}} notice-> family_name:personal_info in condition, personal_info.family_name for results. the field of dt should use ':' as seperator with a reverse order("filed:dt") for conditon, but use '.' as seperator with normal order(dt.field) for results.
  • {"get":{"time_performance":"{>=0}","fields":"[*]"}}
  • {"put":{"key":1234560,"personal_info":{"personid":"0880124199802032569","family_name":"李","name":"三","native_place":"某地","personnel_category":"某种**人员","mt_rank":"某校","mt_appointment":"某长","mt_technical_level":"无","civil_service_level":"无","civil_management_position":"无","political_party":"XXXXX","race":"汉","party_membership_time":"2005-10-05","working_time":"2004-12-01","enlistment_time":"2004-12-01","health_condition":"健康","education":"大学","academic_degree":"本科","graduated":"某院","speciality":"某专业","in-service_education":"无","in-service_academic_degree":"无","in-service_graduated":"无","in-service_speciality":"无","honors_awards":"awards 2次","mt_skills":"某技能","mt_drill":"某大型XXX","resume":"2004.12-2006.09 某XXX soldier;2006.09-2023.06 某XXX commander。"}}}
  • {"upd":{"key":1234560,"personal_info":{"family_name":"liu"}}}
  • {"del":[{"key":123456,"personal_info":{}},{"key":1234560,"personal_info":{}}]}
  • {"close":{"db":"info-energizer"}}
示例代码
  1. resob jsondb 示例代码
import (
	"gitee.com/lineofsight/resob"
)

func main(){
    dbsp, dbspf := InitDbsp(new(DefaultJsonDbAuth))
	log.Println(dbsp)
	defer CloseDbsp(dbsp, dbspf)
	log.Println(dbsp)
	s := "{\"use\":{\"db\":\"test00\",\"remotelog\":\"127.0.0.1:9527\",\"readonly\":false,\"usr\":\"resob000\",\"pwd\":\"jsonany\"}}"
	ur := UseDb(&DbspUseDbParams{s, dbsp, dbspf})
	if ur.E != nil {
		log.Println(ur.E)
	}
	log.Println(ur.Jdb)
	log.Println(dbsp)
	tml := "{\"set\":{\"key\":123456,\"personal_info\":{\"aaa\":\"!\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":1,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
	Jdb, _, rs, e := LocalCenterJsonEngine(dbsp, dbspf, ur.Jdb, tml, nil)
	if e != nil {
		log.Println(rs, e)
	}
	s = "{\"put\":{\"key\":123456,\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
	Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, ur.Jdb, s, nil)
	if e != nil {
		log.Println(e)
	}
	s6 := "{\"put\":{\"personal_info\":{\"anyany\":\"anysdf\tsdfs\\dfe29asdf\",\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
	Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, s6, nil)
	if e != nil {
		log.Println(e)
	}
	s5 := "{\"put\":{\"key\":0123456,\"personal_info\":{\"anyany\":\"anysdf\tsdfs\\dfe29asdf\",\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
	Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, s5, nil)
	if e != nil {
		log.Println(e)
	}
	s0 := "{\"put\":[{\"key\":12345678,\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}},{\"key\":1234560,\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}]}"
	Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, s0, nil)
	if e != nil {
		log.Println(e)
	}
	s1 := "{\"put\":{\"key\":123456,\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
	Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, s1, nil)
	if e != nil {
		log.Println(e)
	}
	s2 := "{\"put\":[{\"key\":1234567823324,\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}},{\"key\":\"1234560\",\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}]}"
	Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, s2, nil)
	if e != nil {
		log.Println(e)
	}
	wg := new(sync.WaitGroup)
	wg.Add(900)
	for i := 0; i < 300; i++ {
		s3 := "{\"put\":{\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
		go func(s string) {
			Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, s, nil)
			if e != nil {
				log.Println(e)
			}
			wg.Done()
		}(s3)
		s4 := "{\"put\":[{\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}},{\"personal_info\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}]}"
		go func(s string) {
			Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, s, nil)
			if e != nil {
				log.Println(e)
			}
			wg.Done()
		}(s4)
		s7 := "{\"put\":{\"personal_info\":{\"anyany\":\"anysdf\tsdfs\\dfe29asdf\",\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
		go func(s string) {
			Jdb, _, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, s, nil)
			if e != nil {
				log.Println(e)
			}
			wg.Done()
		}(s7)
	}
	wg.Wait()
	ss := []string{
		"{\"Get\":{\"personal_info\":\"{>=-6357736063366594537,<=2865645942165471232}\",\"personal_info\":\"{>=-123456,<=123456782332455}\",\"personal_info\":\"{!=123456}\",\"aaa:personal_info\":\"{~`sdf`}\",\"fields\":\"[`personal_info.aaa`,`personal_info.aaab`,`personal_info.arrarrstrct.ccc`,`personal_info.comboolarr`]\"}}",
		"{\"Get\":{\"personal_info\":\"{>=-6357736063366594537,<=6865645942165471232}\",\"fields\":\"[*]\"}}",
	}
	var jr *JsonResults
	for i := 0; i < len(ss); i++ {
		Jdb, jr, rs, e = LocalCenterJsonEngine(dbsp, dbspf, Jdb, ss[i], jr)
		if e != nil {
			log.Println(e)
		}
		log.Println(rs)
		if jr == nil {
			continue
		}
		for {
			jr.SetOrientation(true)
			if jr.IsEnd(true) {
				break
			}
			jr, rs = jr.SomeJsons()
			log.Println(rs)
			jr.SetOrientation(true)
			log.Print("curpageNO--WantedpageNO:")
			log.Println(jr.GetCurWanPageNO())
		}
	}
	s = "{\"close\":{\"db\":\"test00\"}}"
	log.Println(CloseDb(&DbspCloseDbParams{s, ur.Jdb}))
    }
  1. resob jsondt 示例代码

(1) put


import (
	"gitee.com/lineofsight/resob"
)

func main(){
    cs := new(BsTr)
	//must init pool firstly
	cs.InitPool(nil)
	//init a Bstr struct with no nids, and open file "log"
	cs.InitWithLogNonids("", "", true)

	f, err := os.OpenFile("data/putjson.atd", os.O_CREATE|os.O_RDWR, 0644)
	if err != nil {
		log.Println("打开数据文件失败:", err)
	} else {
		defer f.Close()
	}
	binlogf, err := os.OpenFile("binlog/putjson.binlog", os.O_CREATE|os.O_RDWR, 0644)
	if err != nil {
		log.Println("打开数据文件失败:", err)
	} else {
		defer binlogf.Close()
	}
	logc, err := net.Dial("tcp", "127.0.0.1:9528")
	if err != nil {
		log.Println("failed:", err)
	} else {
		defer logc.Close()
	}
	var ckpcs *BsTr
	cs, ckpcs, err = cs.Start(f, binlogf)
	log.Println(ckpcs)
	log.Println("######################################")
	jdt := new(JsonDt)
	jdt.Init(f, binlogf, logc, nil)
	tml := "{\"set\":{\"key\":123456,\"putjsontest0\":{\"aaa\":\"!\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":1,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
	jdt = jdt.SetSpire(cs).SetJsonTemplate(tml, false)
	wg := new(sync.WaitGroup)
	wg.Add(300)
	for i := 0; i < 100; i++ {
		s := "{\"put\":{\"key\":123456,\"putjsontest0\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
		go func(s string) {
			log.Println(jdt.Put(s))
			wg.Done()
		}(s)
		s = "{\"put\":{\"key\":123456,\"putjsontest0\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
		go func(s string) {
			log.Println(jdt.Put(s))
			wg.Done()
		}(s)
		s = "{\"put\":{\"key\":123456,\"putjsontest0\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"
		go func(s string) {
			log.Println(jdt.Put(s))
			wg.Done()
		}(s)
	}
	wg.Wait()
	cs.Plb(0, f, true)
	cs.End(true, f)
}

(2) get

func main(){
    cs := new(BsTr)
	cs.InitPool(nil)
	cs.InitWithLogNonids("", "", true)

	f, err := os.OpenFile("data/putjson.atd", os.O_CREATE|os.O_RDWR, 0644)
	if err != nil {
		log.Println("打开数据文件失败:", err)
	} else {
		defer f.Close()
	}
	binlogf, err := os.OpenFile("binlog/putjson.binlog", os.O_CREATE|os.O_RDWR, 0644)
	if err != nil {
		log.Println("打开数据文件失败:", err)
	} else {
		defer binlogf.Close()
	}
	logc, err := net.Dial("tcp", "127.0.0.1:9528")
	if err != nil {
		log.Println("failed:", err)
	} else {
		defer logc.Close()
	}
	cs, _, _ = cs.Start(f, binlogf)
	log.Println("######################################")
	jdt := new(JsonDt)
	jdt.Init(f, binlogf, logc, nil)
	jdt = jdt.SetSpire(cs)
	jdt = jdt.GetEmbedSpire("putjsontest0")

	log.Println("-----------------------------------")
	ss := []string{
		"{\"Get\":{\"putjsontest0\":{[\"{>=-6357736063366594537,<=2865645942165471232}\",\"{>=-123456,<=1234567823324}\",\"{!=123456}\"],\"aaa\":\"{~`sdf`}\"},\"fields\":\"[`putjsontest0.aaa`,`putjsontest0.aaab`,`putjsontest0.arrarrstrct.ccc`,`putjsontest0.comboolarr`]\"}}",
		"{\"Get\":{\"putjsontest0\":\"{>=-6357736063366594537,<=2865645942165471232}\",\"putjsontest0\":\"{>=-123456,<=2865645942165471232}\",\"putjsontest0\":\"{!=123456}\",\"aaa:putjsontest0\":\"{~`sdf`}\",\"fields\":\"[`putjsontest0.aaa`,`putjsontest0.aaab`,`putjsontest0.arrarrstrct.ccc`,`putjsontest0.comboolarr`]\"}}",
		"{\"Get\":{\"putjsontest0\":\"{>=-6357736063366594537,<=6865645942165471232}\",\"fields\":\"[*]\"}}",
	}
	var jsondata string
	for i := 0; i < len(ss); i++ {
		log.Println("======================================")
		jr := jdt.SetFindJson(ss[i])
		if jr != nil {
			log.Println(jr)
			jr = jr.SomeStart()
			log.Print("curpageNO--WantedpageNO:")
			log.Println(jr.GetCurWanPageNO())
			for {
				jr, jsondata = jr.SomeJsons()
				log.Println(jsondata)
				if jr.IsEnd(true) {
					break
				}
				jr.SetOrientation(true)
				log.Print("curpageNO--WantedpageNO:")
				log.Println(jr.GetCurWanPageNO())
			}
		}
	}
}
  1. BsTr tree 示例代码
import (
	"gitee.com/lineofsight/resob"
)

func main(){
dataf, err := os.OpenFile("data/test.atd", os.O_CREATE|os.O_RDWR, 0644)
	if err != nil {
		log.Println("failed:", err)
	} else {
		defer dataf.Close()
	}
	binlogf, err := os.OpenFile("binlog/test.binlog", os.O_CREATE|os.O_RDWR, 0644)
	if err != nil {
		log.Println("failed:", err)
	} else {
		defer binlogf.Close()
	}
	logc, err := net.Dial("tcp", "127.0.0.1:9528")
	if err != nil {
		log.Println("failed:", err)
	} else {
		defer logc.Close()
	}
	cs := new(BsTr)
	//must init pool firstly
	cs.InitPool(dataf)
	//init a Bstr struct with no nids, and open file "log"
	cs.InitWithLogNonids("", "", true)
	rs := []byte("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
	var cif DefaultCIf
	var ckpcs *BsTr
	cs, ckpcs, _ = cs.Start(dataf, binlogf)
	//if not InitWithLog or InitWithLogNonids,will print to stdout
	log.Println(cs)
	var e error
	var pi, q, p0 int
	rsl := len(rs) - 10
	cs.CT(MEM|UNIQUE|F64KEY|NOSERIAL, 8192, 3, "I love China", dataf)
	cs.CT(MEM|UNIQUE|F64KEY|NOSERIAL, 8192, 3, "Mem | Unique | F64Key | NoSerial", dataf)
	cs.CT(MEM|UNIQUE|I64KEY|NOSERIAL, 8192, 3, "Mem | Unique | I64Key | NoSerial", dataf)
	cs.CT(MEM|UNIQUE|C128KEY|NOSERIAL, 8192, 3, "Mem | Unique | C128Key | NoSerial", dataf)
	cs.CT(MEM|UNIQUE|STRKEY|NOSERIAL, 16384, 3, "Mem | Unique | StrKey | NoSerial", dataf)
	cs.CT(MEM|UNIQUE|F64KEY|NOSERIAL|BIG, 8192, 3, "Mem | Unique | F64Key | NoSerial | Big", dataf)
	cs.CT(Null|BSKEY|NOSERIAL, 16384, 3, "Null | BsKey | NoSerial", dataf)
	cs.CT(MEM|UNIQUE|I64KEY|NOSERIAL|BIG, 8192, 3, "Mem | Unique | I64Key | NoSerial | Big", dataf)
	cs.CT(MEM|UNIQUE|C128KEY|NOSERIAL|BIG, 8192, 3, "Mem | Unique | C128Key | NoSerial | Big", dataf)
	cs.CT(MEM|UNIQUE|STRKEY|NOSERIAL|BIG, 8192, 3, "Mem | Unique | StrKey | NoSerial | Big", dataf)
	cs.CT(MEM|UNIQUE|BSKEY|NOSERIAL|BIG, 8192, 3, "Mem | Unique | 0BsKey | NoSerial | Big", dataf)
	cs.CT(MEM|UNIQUE|STRKEY|NOSERIAL|BIG|FILEBIG, 8192, 3, "Mem | Unique | StrKey | NoSerial | Big | FileBig", dataf)
	cs.CT(MEM|UNIQUE|STRKEY|NOSERIAL|FILEBIG, 8192, 3, "Mem | Unique | StrKey | NoSerial | FileBig", dataf)
	cs.CT(UNIQUE|STRKEY|NOSERIAL|FILEBIG, 8192, 3, "Unique | StrKey | NoSerial | FileBig", dataf)
	cs.CT(UNIQUE|STRKEY|NOSERIAL|BIG, 8192, 3, "Unique | StrKey | NoSerial | Big", dataf)
	cs.CT(Null|STRKEY|NOSERIAL, 8192, 3, "Null | StrKey | NoSerial", dataf)
	cs.CT(UNIQUE|STRKEY|NOSERIAL|COMPRESS, 8192, 3, "Unique | StrKey | NoSerial | Compress", dataf)
	wg := new(sync.WaitGroup)
	count := 800
	wg.Add(5 * count)
	for j := 0; j < 5; j++ {
		for i := 0; i < count; i++ {
			pi = mrand.Intn(rsl)
			q = mrand.Intn(rsl)
			if pi > q {
				pi, q = q, pi
			} else if pi == q {
				q = pi + 5
			}
			p0 = pi
			if q-pi > 1000 {
				pi = q - 1000
			}
			if q-p0 > 128 {
				p0 = q - 128
			}
			if i < 50 {
				p := &putParams{cs, INS, "Mem | Unique | F64Key | NoSerial", mrand.Float64(), []byte(nil), "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 100 {
				rspqcopy := make([]byte, len(rs[p0:q]))
				copy(rspqcopy, rs[p0:q])
				p := &putParams{cs, INS, "Mem | Unique | I64Key | NoSerial", mrand.Int63(), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 150 {
				rspqcopy := make([]byte, len(rs[p0:q]))
				copy(rspqcopy, rs[p0:q])
				p := &putParams{cs, INS, "Mem | Unique | C128Key | NoSerial", complex(mrand.Float64(), mrand.Float64()), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 200 {
				rspqcopy := make([]byte, len(rs[p0:q]))
				copy(rspqcopy, rs[p0:q])
				p := &putParams{cs, INS, "Mem | Unique | StrKey | NoSerial", string(rs[p0:q]), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 250 {
				rspqcopy := make([]byte, len(rs[p0:q]))
				copy(rspqcopy, rs[p0:q])
				var a []byte
				// pass nil directly will be no effect
				// but pass a will be effctive
				p := &putParams{cs, INS, "Null | BsKey | NoSerial", a, rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 300 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Mem | Unique | F64Key | NoSerial | Big", mrand.Float64(), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 350 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Mem | Unique | I64Key | NoSerial | Big", mrand.Int63(), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 400 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Mem | Unique | C128Key | NoSerial | Big", complex(mrand.Float64(), mrand.Float64()), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 450 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Mem | Unique | StrKey | NoSerial | Big", string(rs[p0:q]), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 500 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				rsp0qcopy := make([]byte, len(rs[p0:q]))
				copy(rspqcopy, rs[pi:q])
				copy(rsp0qcopy, rs[p0:q])
				p := &putParams{cs, INS, "Mem | Unique | 0BsKey | NoSerial | Big", rsp0qcopy, rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 550 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Mem | Unique | StrKey | NoSerial | Big | FileBig", string(rs[p0:q]), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 600 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Mem | Unique | StrKey | NoSerial | FileBig", string(rs[p0:q]), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 650 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Unique | StrKey | NoSerial | FileBig", string(rs[p0:q]), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 700 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Unique | StrKey | NoSerial | Big", string(rs[p0:q]), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 750 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Null | StrKey | NoSerial", "", rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			} else if i < 800 {
				rspqcopy := make([]byte, len(rs[pi:q]))
				copy(rspqcopy, rs[pi:q])
				p := &putParams{cs, INS, "Unique | StrKey | NoSerial | Compress", string(rs[p0:q]), rspqcopy, "json", dataf, binlogf, logc, cif}
				go func(p *putParams) {
					_, e = p.cs.Put(p.ops, p.tn, p.key, p.Dts, p.tag, p.f, p.binlogf, p.logc, p.cif, -1)
					log.Println(e)
					wg.Done()
				}(p)
			}
		}
	}
	wg.Wait()
	cs.End(true, dataf)
	cs.Plb(0, dataf, false)
	//checkpoint must use EndOnlyPersis
	ckpcs.EndOnlyPersis(true, binlogf)
	FreeSpire(&cs)
	FreeSpire(&ckpcs)
	runtime.GC()
	// seeing GC recycle memory or not
	time.Sleep(10 * time.Second)
    }
  1. BsTr struct示例代码
import (
	"gitee.com/lineofsight/resob"
)

type AUU struct {
	Ass  [3]string        `json:"auuuss"`
	Afff [3][2][1]float32 `json:"auuufff"`
}
type UUU struct {
	Ass  [3]string              `json:"uuuss"`
	Afff [3][2][1]float32       `json:"uuufff"`
	Aam  map[string]int         `json:"uuuam"`
	Am   map[string]map[int]int `json:"uuum"`
	Ac   complex128             `json:"uuuc"`
	Puu  *UU                    `json:"uu"`
	AUU
}
type UU struct {
	Abool bool
	Ai8   int8
	Ai16  int16
	Ai32  int32
	Ai64  int64
	Ai    int
	Aui8  uint8
	Aui16 uint16
	Aui32 uint32
	Aui64 uint64
	Aui   uint
	As    string
	Ab    [][]byte  `json:"b"`
	Ass   [3]string `json:"ss"`
	Afff  [3][2][1]float32
	Aam   map[string]int         `json:"am"`
	Am    map[string]map[int]int `json:"m"`
	Ac    complex128             `json:"c"`
	Auuu  UUU                    `json:"uuu"`
}

func main() {
	f, err := os.OpenFile("TestBstrPutGet", os.O_CREATE|os.O_RDWR, 0644)
	if err != nil {
		log.Println("open data file failed:", err)
	}
	defer f.Close()
	m := make(map[string]map[int]int)
	mi := make(map[int]int)
	mo := make(map[int]int)
	m["roytoyi"] = mi
	m["poouyyy"] = mo
	mi[9] = 100
	mo[10] = 1000
	ms := make(map[string]int)
	ms["dfgdg"] = 100000
	uu := UU{
		true,
		1,
		2,
		3,
		4,
		5,
		6,
		7,
		8,
		9,
		10,
		"sdklfsdk",
		[][]byte{{0}, {1}, {1, 2, 3}, {4, 5, 6, 7, 8}},
		[3]string{"55566", "3454", "234324"},
		[3][2][1]float32{{{11}, {12}}, {{13}, {14}}, {{15}, {16}}},
		ms,
		m,
		23334343 + 45645456i,
		UUU{[3]string{"uuu55566", "uuu3454", "uuu234324"},
			[3][2][1]float32{{{111}, {112}}, {{113}, {114}}, {{115}, {116}}},
			ms,
			m,
			111123334343 + 45645456i,
			nil,
			AUU{[3]string{"auuu55566", "auuu3454", "auuu234324"}, [3][2][1]float32{{{111}, {112}}, {{113}, {114}}, {{115}, {116}}}}},
	}
	var key string
	var cs BsTr
	cs.InitPool(f)
	cs.InitWithLog("世界", "你好")
	log.Println("--------------------------------------------Put/Get structure/map etc.")
	//k是ID,由IDxy()生成。IDxy()采用类snowflake算法
	//param 4 is nil, return a new key by auto
	for i := 0; i < 100; i++ {
		k, e := cs.PutAnyByKey(uu, "", "json", nil, 1577808000000)
		log.Println(k)
		log.Println(e)
		log.Println(cs)
	}
	log.Println("-----------------------------------------读取结构体等")
	ppcs := new(BsTr)
	ppcs.InitWithoutBT()
	var e error
	k := ""
	//if &k==nil,key将自动生成
	//此时为空key Put
	ppcs.PutAnyByKey(m, "", "json", &k, 1577808000000)
	log.Println(ppcs)
	mm := make(map[string]map[int]int)
	log.Println(ppcs.GetAnyByKey(k, &mm))
	log.Println(mm)
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	key, _ = ppcs.PutAnyByKey(uu.Afff, "", "json", &k, 1577808000000)
	log.Println(ppcs)
	var ffff [3][2][1]float32
	log.Println(ppcs.GetAnyByKey("", &ffff))
	log.Println(ffff)
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	key, _ = ppcs.PutAnyByKey(uu.Ab, "", "json", &k, 1577808000000)
	log.Println(ppcs)
	var bb [][]byte
	log.Println(ppcs.GetAnyByKey("", &bb))
	log.Println(bb)
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	ppcs.PutAnyByKey(uu, "", "json", &k, 1577808000000)
	log.Println(ppcs)
	log.Println(ppcs.Save(0, f))
	tppcs, _, e := GetFromFileOff(ppcs.Offset(), f)
	log.Println(tppcs)
	log.Println(e)
	log.Println(reflect.DeepEqual(tppcs, ppcs))
	var gcsuu, gcsuu4 UU
	log.Println(ppcs.GetAnyByKey("", &gcsuu))
	log.Println(tppcs.GetAnyByKey("", &gcsuu4))
	log.Println(reflect.DeepEqual(gcsuu, gcsuu4))
	//struct field name
	//key is ""
	b, _ := ppcs.GetBool("Abool")
	log.Println(*b)
	log.Println("uu", uu)
	log.Println("gcsuu", gcsuu)
	log.Println(reflect.DeepEqual(gcsuu, uu))
	//use sort carefully
	sort.Sort(ppcs)
	log.Println(ppcs)
	log.Println(ppcs.GetAnyByKey(key, &gcsuu4))
	log.Println("uu", uu)
	log.Println("gcsuu4", gcsuu4)
	log.Println(reflect.DeepEqual(gcsuu4, uu))
	log.Println("--------------------key非空------------------")
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	key, _ = ppcs.PutAnyByKey(m, "", "json", nil, 1577808000000)
	log.Println(ppcs)
	mm = make(map[string]map[int]int)
	log.Println(ppcs.GetAnyByKey(key, &mm))
	log.Println(mm)
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	key, _ = ppcs.PutAnyByKey(uu.Afff, "", "json", nil, 1577808000000)
	log.Println(ppcs)
	log.Println(ppcs.GetAnyByKey(key, &ffff))
	log.Println(ffff)
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	key, _ = ppcs.PutAnyByKey(uu.Ab, "", "json", nil, 1577808000000)
	log.Println(ppcs)
	log.Println(ppcs.GetAnyByKey(key, &bb))
	log.Println(bb)
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	key, _ = ppcs.PutAnyByKey(uu, "", "json", nil, 1577808000000)
	log.Println(ppcs)
	var gcsuu3, gcsuu1, gcsuu2 UU
	log.Println(ppcs.GetAnyByKey(key, &gcsuu3))
	b, _ = ppcs.GetBool("Abool:" + key)
	log.Println(*b)
	log.Println("uu", uu)
	log.Println("gcsuu", gcsuu3)
	log.Println(reflect.DeepEqual(gcsuu3, uu))
	key1, _ := ppcs.PutAnyByKey(uu, "", "json", nil, 1577808000000)
	log.Println(ppcs)
	log.Println(ppcs.GetAnyByKey(key1, &gcsuu2))
	log.Println(ppcs.GetAnyByKey(key, &gcsuu1))
	log.Println("gcsuu21", gcsuu1)
	log.Println("gcsuu2", gcsuu2)
	log.Println(reflect.DeepEqual(gcsuu2, gcsuu1))
	log.Println(reflect.DeepEqual(uu, gcsuu1))
	log.Println("-----------------------------------------加入指针Put/Get")
	gcsuu.Auuu.Puu = &uu
	log.Println("gcsuu.Auuu.Puu", gcsuu.Auuu.Puu)
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	k, e = ppcs.PutAnyByKey(gcsuu, "", "json", &key, 1577808000000)
	log.Println(key, ":", k)
	log.Println(e)
	log.Println(ppcs)
	var pgcsuu UU
	e = ppcs.GetAnyByKey(k, &pgcsuu)
	log.Println(e)
	log.Println(pgcsuu)
	b, _ = ppcs.GetBool("Abool:" + k)
	log.Println(*b)
	log.Println(gcsuu)
	log.Println(gcsuu.Auuu.Puu)
	//not support ptr
	log.Println(reflect.DeepEqual(pgcsuu, gcsuu))
	log.Println(pgcsuu.Auuu.Puu)
	log.Println("-----------------------------------------Delete/Rollback")
	ppcs = new(BsTr)
	ppcs.InitWithoutBT()
	var r [MAXSNADD1 + 1]int
	ppcs.PutBool(true, "0", "1", "2")
	r[BOOLSN] += 1
	ppcs.PutInt8(1, "3", "4", "5")
	ppcs.PutInt16(2, "6", "7", "8")
	ppcs.PutInt32(1, "63", "4", "5")
	ppcs.PutInt64(2, "66", "7", "8")
	ppcs.PutUint8(1, "73", "4", "5")
	ppcs.PutUint16(2, "76", "7", "8")
	ppcs.PutUint32(1, "83", "4", "5")
	ppcs.PutUint64(2, "86", "7", "8")
	ppcs.PutFloat32(1, "93", "4", "5")
	ppcs.PutFloat64(2, "96", "7", "8")
	ppcs.PutComplex64(1, "103", "4", "5")
	r[COMPLEX64SN] += 1
	ppcs.PutComplex128(2, "106", "7", "8")
	ppcs.PutString("1", "3", "104", "5")
	ppcs.PutBytes([]byte("1"), "116", "7", "8")
	ppcs.PutBsk([]byte("1"), "", "", "")
	r[BYTEKEYSN] += 1
	ppcs.PutChunk(ppcs)
	r[MAXSNADD1] += 1
	ppcs.PutOff(1)
	ppcs.PutTm(2)
	log.Println(ppcs)
	log.Println(ppcs.Rollback(r, 0))
	log.Println(ppcs)

	ppcs.PutBool(true, "000", "1", "2")
	ppcs.PutInt8(1, "003", "4", "5")
	ppcs.PutInt16(2, "006", "7", "8")
	r[INT16SN] += 1
	ppcs.PutInt32(1, "003", "4", "5")
	ppcs.PutInt64(2, "600", "7", "8")
	ppcs.PutUint8(1, "300", "4", "5")
	ppcs.PutUint16(2, "116", "7", "8")
	ppcs.PutUint32(1, "113", "4", "5")
	ppcs.PutUint64(2, "611", "7", "8")
	ppcs.PutFloat32(1, "311", "4", "5")
	ppcs.PutFloat64(2, "622", "7", "8")
	ppcs.PutComplex64(1, "302", "4", "5")
	ppcs.PutComplex128(2, "633", "7", "8")
	ppcs.PutString("1", "333", "4", "5")
	r[STRINGSN] += 1
	ppcs.PutBytes([]byte("144"), "6", "7", "8")
	r[BYTESN] += 1
	ppcs.PutBsk([]byte("104"), "", "", "")
	ppcs.PutChunk(ppcs)
	r[MAXSNADD1] += 1
	ppcs.PutOff(1)
	r[OFFSSN] += 1
	ppcs.PutTm(2)
	log.Println(ppcs)
	log.Println(ppcs.Rollback(r, 2))
	log.Println(ppcs)

	ppcs.PutString("11", "3331", "4", "5")
	ppcs.PutString("12", "3332", "4", "5")
	ppcs.PutString("13", "3333", "4", "5")
	ppcs.PutString("14", "3334", "4", "5")
	ppcs.PutString("15", "3335", "4", "5")
	ppcs.PutString("16", "3336", "4", "5")
	ppcs.PutString("17", "3337", "4", "5")
	ppcs.PutString("18", "3338", "4", "5")
	ppcs.PutString("19", "3339", "4", "5")
	log.Println(ppcs)
	log.Println(ppcs.Delete(STRINGSN, 3, 3))
	log.Println(ppcs)

	ppcs.PutBool(true, "00000", "1", "2")
	ppcs.PutInt8(1, "00003", "4", "5")
	ppcs.PutInt16(2, "00006", "7", "8")
	ppcs.PutInt32(1, "00003", "4", "5")
	ppcs.PutInt64(2, "60000", "7", "8")
	ppcs.PutUint8(1, "30000", "4", "5")
	ppcs.PutUint16(2, "10016", "7", "8")
	ppcs.PutUint32(1, "10013", "4", "5")
	ppcs.PutUint64(2, "60011", "7", "8")
	ppcs.PutFloat32(1, "30011", "4", "5")
	ppcs.PutFloat64(2, "60022", "7", "8")
	ppcs.PutComplex64(1, "30002", "4", "5")
	ppcs.PutComplex128(2, "60033", "7", "8")
	ppcs.PutString("1", "30033", "4", "5")
	ppcs.PutBytes([]byte("10044"), "6", "7", "8")
	ppcs.PutBsk([]byte("10004"), "", "", "")
	ppcs.PutChunk(ppcs)
	ppcs.PutOff(1)
	ppcs.PutTm(2)
	ppcs.PutBool(true, "100000", "1", "2")
	ppcs.PutInt8(1, "100003", "4", "5")
	ppcs.PutInt16(2, "100006", "7", "8")
	ppcs.PutInt32(1, "100003", "4", "5")
	ppcs.PutInt64(2, "160000", "7", "8")
	ppcs.PutUint8(1, "130000", "4", "5")
	ppcs.PutUint16(2, "110016", "7", "8")
	ppcs.PutUint32(1, "110013", "4", "5")
	ppcs.PutUint64(2, "160011", "7", "8")
	ppcs.PutFloat32(1, "130011", "4", "5")
	ppcs.PutFloat64(2, "160022", "7", "8")
	ppcs.PutComplex64(1, "130002", "4", "5")
	ppcs.PutComplex128(2, "160033", "7", "8")
	ppcs.PutString("1", "130033", "4", "5")
	ppcs.PutBytes([]byte("110044"), "6", "7", "8")
	ppcs.PutBsk([]byte("110004"), "", "", "")
	ppcs.PutChunk(ppcs)
	ppcs.PutOff(1)
	ppcs.PutTm(2)
	for i := 0; i < MAXSNADD1+1; i++ {
		r[i] = 2
	}
	log.Println(ppcs)
	log.Println(ppcs.Rollback(r, 1))
	log.Println(ppcs)
}

Documentation

Overview

package resob implements complicated functions about a BsTr tree. resob is remote service of BsTr tree.

package resob implements a struct of Bstr and a datastructure called BstarTree or BlinkTree. resob is remote service of BsTr tree, using a pulsating workflow pattern for processing concurrency, only realized with go standard library, no extra dependency. package resob implements complicated functions about a BsTr tree.

Struct Bstr provides base Put* and Get* methods that can take in most type of data, e.g. int64, int, float64, complex128 etc. base type and composite type. the put api in ip.go, e.g. PutAnyByKey. the get api in ig.go, e.g. GetAnyByKey. the delete api in BsTrstruct_delete.go, e.g. Delete. BsTr tree based on Bstr struct can wander between memory chunks and disk pages, and provide tree Put/Get methods for operating the tree.

BsTrtree*.go is a series of base operation for a BsTr tree. e.g. Start start a BsTr tree; CT create a tn in a spire of a BsTr tree. Put put/del/update data into/from/for a a spire of a BsTr tree. Get get data from a spire of a BsTr tree; CGet* methods realize similar function. FindParams realize complicated functions with a json format request: condition search and paged results. all function based on BsTrtree_swput.go BsTrtree_swget.go(STRKEY),BsTrtree_iwput.go BsTrtree_iwget.go(I64KEY), BsTrtree_fwput.go BsTrtree_fwget.go(F64KEY), BsTrtree_cwput.go BsTrtree_cwget.go(COMPLEX128KEY), BsTrtree_bwput.go BsTrtree_bwget.go(BSKEY--[]byte).

resob_jsonpsrser.go: realized a quick json parser. analyze json gramma quickly. parser a josn to a BsTr struct.

resob_jsondt*.go: implemented putting json data to and search json data from a BsTr tree. process json data conveniently, and provide Put/Del/Upd/Get method for using. put withkey as follow: i64key format json: {"put":{"key":1234565,"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}}} or strkey format json: {"put":{"key":"1234565","tn":{"field0":num0,"field1":"str0","field2":true,"field3":4356}}} non-key as follow: system will generate a autoinc-int64 key(or tostring) with tn flag {"put":{"tn":{"field0":num0,"field1":"str0","field2":true,"field3":345}}} bat Put: {"put":[{"key":1234565,"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}},{"key":343453,"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}}]} {"put":[{"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}},{"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}}]}

delete withkey as follow: a del-json has a fixed format, as follows: a del-json with a key: "{\"del\":{\"key\":\"123456\",\"deljsontest\":{}}}" a del-json for bat deleting: "{\"del\":[{\"key\":\"123456\",\"deljsontest\":{},{\"key\":\"1234560\",\"deljsontest\":{}]}"

update withkey as follow: a upd-json has a fixed format, as follows: a upd-json with a key: "{\"upd\":{\"key\":\"123456\",\"updjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}" a upd-json for bat updating: "{\"upd\":[{\"key\":\"123456\",\"updjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}},{\"key\":\"1234560\",\"updjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}]}"

get as follow: {"get":{"family_name:personal_info":"{~`李`}","fields":"[`personal_info.family_name`,`personal_info.name`]"}} results json (i64key for example): [{"key":23434}, "tn":{"filed0":"dfd","field1":435,"field2":true,"field3":[{...}]},{"key":345}, "tn":{"filed0":"dfdrtret","field1":45435,"field2":true,"field3":[{...}]}]

resob_jsondb*.go: implemented putting json data to and search json data from some jsondts, and *Dbsp* series of function for managing jsondbs.

Index

Constants

View Source
const (
	BOOLSN = iota
	INT8SN
	INT16SN
	INT32SN
	INT64SN
	UINT8SN
	UINT16SN
	UINT32SN
	UINT64SN
	FLOAT32SN
	FLOAT64SN
	COMPLEX64SN
	COMPLEX128SN
	STRINGSN
	BYTESN
	BYTEKEYSN
	OFFSSN
	TMSSN
	MAXSNADD1
)
View Source
const (
	BIT0  = 0x0001
	BIT1  = 0x0002
	BIT2  = 0x0004
	BIT3  = 0x0008
	BIT4  = 0x0010
	BIT5  = 0x0020
	BIT6  = 0x0040
	BIT7  = 0x0080
	BIT8  = 0x0100
	BIT9  = 0x0200
	BIT10 = 0x0400
	BIT11 = 0x0800
	BIT12 = 0x1000
	BIT13 = 0x2000
	BIT14 = 0x4000
	BIT15 = 0x8000 //delete flag
)
View Source
const (
	MAXSIZE       = 655350000
	RDBUFSZ       = 655350
	DefaultChanSz = 655350
)
View Source
const (
	KONGIDSN  = -2
	NUDECSLEN = 1 + 1 + 8 + 8 + 2 + int64(unsafe.Sizeof(IntBTlen(0))*2+unsafe.Sizeof(IntLens(0))*MAXSNADD1) + 8
)
View Source
const (
	IDREGS    = `^[\S]{0,513}$`
	FIELDREGS = `^[\S ]{0,1000}$`
	DESREGS   = `^[\S ]{0,1000}$`
	BTREGS    = `^[a-zA-Z0-9\p{Han}][\w\p{Han}-_.:|]{0,128}$`
)
View Source
const (
	WR      = 0x0000000000000001
	RR      = 0x0000000000000002
	MR      = 0x0000000000000004
	RhtR    = 0x0000000000000008
	WRR     = 0x0000000000000010
	RRR     = 0x0000000000000020
	MRR     = 0x0000000000000040
	RhtRR   = 0x0000000000000080
	WRRe    = 0x0000000000000100
	RRRe    = 0x0000000000000200
	MRRe    = 0x0000000000000400
	RhtRRe  = 0x0000000000000800
	WRReR   = 0x0000000000010000
	RRReR   = 0x0000000000020000
	MRReR   = 0x0000000000040000
	RhtRReR = 0x0000000000080000
	WNoR    = 0x0000000000100000
	MNoR    = 0x0000000000200000
	WNoRRe  = 0x0000000000400000
	MNoRRe  = 0x0000000000800000
	DR      = 0x0000000001000000
	DRR     = 0x0000000002000000
	DRRe    = 0x0000000004000000
	DRReR   = 0x0000000008000000
	DNoR    = 0x0000000010000000
	DNoRRe  = 0x0000000020000000
	OR      = 0x0000000040000000
	ORR     = 0x0000000080000000
	ORRe    = 0x0000000100000000
	ORReR   = 0x0000000200000000
)
View Source
const (
	VERSION     = 0.1    //data version
	MAGICNUMBER = 0x3679 // the magic number demonstrates that it is a Bstr tree saved in a file
)
View Source
const (
	NUMBERED = 0x0001 // maybe not precise when Bstr tree is wandering between memory and disk. Use carefully
	UNIQUE   = 0x0002
	EMBEDED  = 0x0004 // no data:bs
	STRKEY   = 0x0008
	I64KEY   = 0x0010
	F64KEY   = 0x0020
	C128KEY  = 0x0040
	NOSERIAL = 0x0080
	BIG      = 0x0100 // no data:bs
	BSKEY    = 0x0200
	COMPRESS = 0x0400
	FILEBIG  = 0x0800 //chunk only has left/right/parent, bs nil, if BIG, no bs
	Null     = 0x1000 // if key is []byte or string,Null demonstrates "key can be null"
	MEM      = 0x2000 // only mem,collide with binlog\filebig and ticksave ops; MEM ops not recorded in binlog file
	REMOTE   = 0x4000 // binlog and data save in remote machine
	//datatype, not must needed
	STRDATA  = 0x8000
	I64DATA  = 0x10000
	F64DATA  = 0x20000
	C128DATA = 0x40000
	BSDATA   = 0x80000
	BOOLDATA = 0x100000
	I8DATA   = 0x200000
	I16DATA  = 0x400000
	I32DATA  = 0x800000
	U8DATA   = 0x1000000
	U16DATA  = 0x2000000
	U32DATA  = 0x4000000
	U64DATA  = 0x8000000
	F32DATA  = 0x10000000
	C64DATA  = 0x20000000
	BSTRDATA = 0x40000000
)
View Source
const (
	INS = iota
	UPD // only can update in Unique mode
	UPDNOTUNIQUE
	DEL // only can delete in Unique mode
	DELNOTUNIQUE
	TKS // ticksave, not available currently.
	Rd
)
View Source
const (
	SYSPRESETBLANKSPCETN = " "
	EMBEDTNAT            = "@"
	EMBEDTNCOLON         = ":"
	EMBEDTNDOT           = "."
)
View Source
const (
	P       = 0x0001
	R       = 0x0002
	L       = 0x0004
	I       = 0x0008
	TN      = 0x0010
	SPTOTAL = 0x0020
	BIGDATA = 0x0040
	EITOTAL = 0x0080
	LRU     = 0x0100
)
View Source
const (
	DEFAULTFLAG        = MEM | UNIQUE | STRKEY | NOSERIAL
	DEFAULTPOMAPCAP    = 65535000
	DEFAULTPOMAPLEN    = 1024000
	KEYMAXPAGEPERCENT  = 0.055
	MAXPAGESZ          = 655350
	MINIDXDATANUMS     = 2
	DATAMAXPAGEPERCENT = 0.11
	MAXIDXDATANUMS     = 1000
	MAXUINT64          = ^uint64(0)
	MINDATASZ          = NUDECSLEN + 25
	SPIRESIZE          = 5120000
	MINTNLEN           = 1
	ISSPIRE            = -3
	ISLEAF             = -1
	ISOVERLEAF         = -2
	UNKONWLEVEL        = -4
	BIGDATARETURN      = -5
	NOTLEAFRETURN      = -6
	RETURNNOOVERs      = -7
	MAXALLOCSZ         = 0x7FFFFFFF
	LRUTIME            = 1 * time.Second
	TKSTIME            = 600 * time.Second
	DEFAULTPAGESIE     = 8192
)
View Source
const (
	// preset chunk index
	PARENT = iota
	LEFT
	RIGHT
	CHUNKINDEXIGNORE        // Ignored index: chunk parent left right
	SPIREI8SINDEXIGNORE = 1 // Ignored index: ISSPIRE max level
	I8SINDEXIGNORE      = 1 // Ignored index: level
	//must or should avoid uint64 key, should use []byte replace
	UI64SINDEXIGNORE             = 2 // createts,lastts(exclude spire)
	UI64SINDEXIGNORE4NUMBERED    = 4 // Ignored index: autoid pageid, when key is uint64, indexes must be ignored
	UI64SINDEXIGNORE4NONNUMBERED = 3 // Ignored index: total, when key is uint64, total/entry indexes must be ignored,exclude spire
)
View Source
const (
	GETEQUAL   = 0x0001
	GETCONTAIN = 0x0002
	GETPREFIX  = 0x0004
	GETSUFFIX  = 0x0008
)
View Source
const (
	CFREEINS    = 1
	CFREEDEL    = 2
	CFREEGET1   = 3
	CFREEGETALL = 4
	CFREE4DROP  = 5
)
View Source
const (
	JSONDBUSEOPS         = "use"
	JSONDBCLOSEOPS       = "close"
	JSONDBFIELD          = "db"
	JSONDBREMOTELOGFIELD = "remotelog"
	JSONDBREADONLYFIELD  = "readonly"
	JSONDBOWNERUSRFIELD  = "usr"
	JSONDBOWNERPWDFIELD  = "pwd"
)

use Db: {"use":{"db":"test","remotelog":"127.0.0.1:9527","readonly":false,"usr":"resob","pwd":"jsonany"}} close Db: {"close":{"db":"test"}}

View Source
const (
	DEFAULTDTATPATH   = "./data/"
	DEFAULTBINLOGPATH = "./binlog/"
)
View Source
const (
	DEFAULTDBOWNER    = "resob"
	DEFAULTDBOWNERPWD = "jsonany"
)
View Source
const (
	JSONDTDATA                  = "data"
	JSONDTPUTOPS                = "put"
	JSONDTSETOPS                = "set"
	JSONDTGETOPS                = "get"
	JSONDTUPDOPS                = "upd"
	JSONDTDELOPS                = "del"
	JSONDTKEY                   = "key"
	JSONDTTN                    = "tn"
	JSONRESULTSPAGEOPS          = "page"
	JSONRESULTSPAGENEXT         = "next"
	JSONRESULTSPAGEPREV         = "prev"
	JSONRESULTSSETPAGESHOULDHAS = "shouldhas"
	JSONDBSPGETOPS              = "showdbs"
	JSONDBSPIREGETOPS           = "showdts"
	JSONDBUPDATEPWD             = "updpwd"
)
View Source
const (
	DEFAULTEMBEDSPIRESIZE = 512000
	DEFAULTJSONPAGESIZE   = 16384
)
View Source
const (
	I64KEYUNIQUESET        = 1
	F64KEYUNIQUESET        = 1.1
	I64KEYDEFAULT          = I64KEY | NOSERIAL
	F64KEYDEFAULT          = F64KEY | NOSERIAL
	I64KEYUNIQUE           = I64KEY | NOSERIAL | UNIQUE
	F64KEYUNIQUE           = F64KEY | NOSERIAL | UNIQUE
	BSKEYDEFAULT           = BSKEY | Null | NOSERIAL
	STRKEYNOTNULLSET       = "!"
	STRKEYUNIQUESET        = "u"
	STRKEYUNIQUENOTNULLSET = "v"
	STRKEYDEFAULT          = STRKEY | Null | NOSERIAL
	STRKEYNOTNULL          = STRKEY | NOSERIAL
	STRKEYUNIQUE           = STRKEY | UNIQUE | Null | NOSERIAL
	STRKEYUNIQUENOTNULL    = STRKEY | UNIQUE | NOSERIAL
)

template:{"put":{"key":123456, tn":{"field0":num0,"field1":"str0","field2":true,"field3":{...}}}}} number field:1(1.1) unique, ,default: I64KEY|NOSERIAL, F64KEY|NOSERIAL string field:"", demonstrate string field can be null,!"" not null,"u" ,default: STRKEY|Null|NOSERIAL other type field: BSKEY|Null|NOSERIAL

View Source
const (
	FindBegin      = 0x0001  //{
	FindEnd        = 0x0002  //}
	FindG          = 0x0004  //>
	FindGE         = 0x0008  //>=
	FindE          = 0x0010  //=
	FindL          = 0x0020  //<
	FindLE         = 0x0040  //<=
	FindNE         = 0x0080  //!=
	FindLike       = 0x0100  //~
	FindComma      = 0x0200  //, comma in a finding-wanted string
	FindNull       = 0x0400  //null field for a finding-key
	FindEOF        = 0x0800  //EOF
	FindAny        = 0x1000  //all:*
	FindValueStr   = 0x2000  //str value for a finding-key
	FindValueNum   = 0x4000  //num value for a finding-key
	FindValueTrue  = 0x8000  //true value for a finding-key
	FindValueFalse = 0x10000 //false value for a finding-key
)

tokens of a get-json parser

View Source
const (
	ResultBegin    = 0x0001 //{
	ResultEnd      = 0x0002 //}
	ResultEOF      = 0x0004 //EOF
	ResultFieldStr = 0x0008 //result field in a result-wanted string
	ResultComma    = 0x0010 //comma in a result-wanted string
	ResultStar     = 0x0020 // *
)
View Source
const (
	JsonObjStart     = 0x0001
	JsonObjEnd       = 0x0002
	JsonArrStart     = 0x0004
	JsonArrEnd       = 0x0008
	JsonNULL         = 0x0010
	JsonNum          = 0x0020
	JsonStr          = 0x0040
	JsonField        = 0x0080
	JsonColon        = 0x0100
	JsonComma        = 0x0200
	JsonTrue         = 0x0400
	JsonFalse        = 0x0800
	JsonBraceBegin   = 0x1000
	JsonBraceEnd     = 0x2000
	JsonSameType     = 0x4000
	JsonEOF          = 0x8000
	JsonStrField     = 0x10000
	JsonObjField     = 0x20000
	JsonArrField     = 0x40000
	JsonAnyField     = 0x80000
	JsonNumField     = 0x100000
	JsonBoolField    = 0x200000
	JsonArrStr       = 0x400000
	JsonArrNum       = 0x800000
	JsonArrTrue      = 0x1000000
	JsonArrFalse     = 0x2000000
	JsonArrNULL      = 0x4000000
	JsonBracketBegin = 0x8000000
	JsonBracketEnd   = 0x10000000
)

this is a quick json parser parser json to a BsTr struct the flow by using the parse: var jstr JsonParser--jstr.SetReader(s)--jstr.Tokening()--jstr.FindNormalGrammaError()-- ts := jstr.GetTokens()--jstr.DissambleObj(ts[0], 1, len(ts))--jstr.CheckArrTypeRoute()--jstr.GetJsonKvs()

View Source
const (
	PUTJSON = 0x0001
	GETJSON = 0x0002
	SETTMPL = 0x0004
)

flag of PUTJSON and GETJSON used in GetJsonKvs

View Source
const (
	MILISHIFT = 17
	RSHIFT    = 12
	SEQSHIFT  = 0
	MILIMASK  = 0x7FFFFFFFFFFE0000
	SEQMASK   = 0x0000000000000FFF
	RMASK     = 0x000000000001F000
	RMAX      = 0x001F
)
View Source
const (
	RandomSEQONE    = 0x0010000000000000
	RandomMILISHIFT = 23
	RandomRSHIFT    = 41
	RandomSEQSHIFT  = 52
	RandomMILIMASK  = 0x000001FFFFFFFFFF
	RandomMAXMASK   = 0x7FFFFE0000000000
	RandomSEQMASK   = 0x7FF0000000000000
	RandomRMASK     = 0x000FFE0000000000
	RandomRMAX      = 0x0FFE
	RandomSEQMAX    = 0x7FF
)
View Source
const (
	DEFAULTPAGESHOULDHAS = 10 // the default items of a page had
)

Variables

View Source
var (
	ErrReadOnly                              = errors.New("!w")
	ErrTypeAssert                            = errors.New("!typeAssertion")
	ErrKeyEmbebedTn                          = errors.New("embebed:STRKEY||I64KEY")
	ErrPage4EmbededFull                      = errors.New("embebed:full")
	ErrNotInited                             = errors.New("embeded:!inited")
	ErrWanderHalfWay                         = errors.New("wander:halfway")
	ErrSomeStartFirst                        = errors.New("SomeStart-Some")
	ErrNotNeedWander                         = errors.New("wander:no")
	ErrGramma                                = errors.New("!gramma")
	ErrInMultiThreadEnv                      = errors.New("!multithrea")
	ErrInSingleThreadEnv                     = errors.New("!singlethread")
	ErrFreetreetnOrCharnotpermit             = errors.New("!create")
	ErrTnNotExist                            = errors.New("tn:!Exist")
	ErrBusy                                  = errors.New("busy")
	ErrRegexpdismatch                        = errors.New("!regexp")
	ErrZouguolen                             = errors.New("!pastlen")
	ErrNonids                                = errors.New("!nonids")
	ErrNidsdismatch                          = errors.New("regexp:!nids")
	ErrCoexlezero                            = errors.New("!qorindex")
	ErrIndexout                              = errors.New("!index")
	ErrKeynullornonids                       = errors.New("!key|nonids")
	ErrDeleted                               = errors.New("!del")
	ErrBigbigdata                            = errors.New("!data")
	ErrCheckflagandlenfalse                  = errors.New("!flagAndlen")
	ErrChecklenfalse                         = errors.New("!CheckLen")
	ErrCorrupt0                              = errors.New("0:!data")
	ErrCorrupt1                              = errors.New("1:!data")
	ErrRbsdoublenil                          = errors.New("!!")
	ErrLensz                                 = errors.New("!len|MAXSIZE")
	ErrPtrneeded                             = errors.New("!ptr")
	ErrKeynotexist                           = errors.New("!existed")
	ErrNotsupportedtype                      = errors.New("!type")
	ErrNotfound                              = errors.New("!found")
	ErrNotsupportedkey                       = errors.New("!keytype")
	ErrNotcontain                            = errors.New("!result")
	ErrSpirefull                             = errors.New("spire:full")
	ErrFlagmismatch                          = errors.New("!flag")
	ErrCsnotempty                            = errors.New("!empty")
	ErrFatal                                 = errors.New("fatal")
	ErrInited                                = errors.New("inited")
	ErrChunknilorempty                       = errors.New("nil|empty")
	ErrPutchunkfailed                        = errors.New("failed")
	ErrUnknown                               = errors.New("unknown")
	ErrUniquenull                            = errors.New("UNIQUE<>Null")
	ErrNotSerialData                         = errors.New("!serial")
	ErrNoserialdata                          = errors.New("![]byte")
	ErrFlagkeydismatch                       = errors.New("!match:flag@key")
	ErrFlagdismatch                          = errors.New("!flag")
	ErrPropablyspirefull                     = errors.New("full|unknown")
	ErrBigmodedata                           = errors.New("!Big")
	ErrOps                                   = errors.New("!ops")
	ErrOpsdismatchflag                       = errors.New("!ops@flag")
	ErrBigdata                               = errors.New("!big data")
	ErrKeyexisted                            = errors.New("existed")
	ErrBigkey                                = errors.New("!key")
	ErrCorruptpage                           = errors.New("!page")
	ErrIdxy                                  = errors.New("IDxy:0")
	ErrNilin                                 = errors.New("nil-in")
	ErrCaninterface                          = errors.New("!interface")
	ErrNotsupportedvalue                     = errors.New("!value")
	ErrNotspire                              = errors.New("!spire")
	ErrFlagmemcachecollide                   = errors.New("collide")
	ErrReadn                                 = errors.New("!n")
	ErrOffset_1                              = errors.New("-1:off")
	ErrDeleteFailed                          = errors.New("del:failed")
	ErrLength_0                              = errors.New("len:0")
	ErrOffset_0                              = errors.New("off:0")
	ErrReturnNil                             = errors.New("re:nil")
	ErrReturnFalse                           = errors.New("re:false")
	ErrSpire                                 = errors.New("spire:error")
	ErrChanNotOK                             = errors.New("chan:!ok")
	ErrRouteHasFullOrWillFull                = errors.New("route:full(will)")
	ErrFullOrWillFull                        = errors.New("full(will)")
	ErrDelUpdNotunique                       = errors.New("Del||Upd:UNIQUE")
	ErrTnnotexistedAndFlagnotSupportCreateTn = errors.New("!Tn!flag")
)

Functions

func AnyEKeySearch

func AnyEKeySearch(ts []any, t any) int

func AnyEKeySearchTms

func AnyEKeySearchTms(ts []any, t any, tmss []int64, tms int64) int

func AnyGCKeySearch

func AnyGCKeySearch(ts []any, t any) int

func AnyGEKeySearch

func AnyGEKeySearch(ts []any, t any) int

func AnyGEKeySearchTms

func AnyGEKeySearchTms(ts []any, t any, tmss []int64, tms int64) int

func AnyGKeySearch

func AnyGKeySearch(ts []any, t any) int

func AnyGKeySearchTms

func AnyGKeySearchTms(ts []any, t any, tmss []int64, tms int64) int

func AnyGPKeySearch

func AnyGPKeySearch(ts []any, t any) int

func AnyGSKeySearch

func AnyGSKeySearch(ts []any, t any) int

func AnyLEKeySearch

func AnyLEKeySearch(ts []any, t any) int

func AnyLEKeySearchTms

func AnyLEKeySearchTms(ts []any, t any, tmss []int64, tms int64) int

func AnyLKeySearch

func AnyLKeySearch(ts []any, t any) int

func AnyLKeySearchTms

func AnyLKeySearchTms(ts []any, t any, tmss []int64, tms int64) int

func AnyLike

func AnyLike(r any, t any) int

func BsTrFileServ

func BsTrFileServ(n, ap string) error

BsTrFileServ starts a remote server for filing a Bstr by channel request in i_BsTrstruct_ffunc.go

func ChanIsClosed

func ChanIsClosed[T any](c chan T) bool

func ChaosBytes

func ChaosBytes(bs []byte) []byte

ChaosBytes generates chaos bytes

func CloseDb

func CloseDb(cdparams *DbspCloseDbParams) error

func CloseDb0

func CloseDb0(cdparams *DbspCloseDbParams0) error

func CloseDbsp

func CloseDbsp(dbsp *BsTr, f *os.File)

func EKeySearch

func EKeySearch[T KeyType](ts []T, t T) int

search key equal, bug

func EKeySearchTms

func EKeySearchTms[T KeyType](ts []T, t T, tmss []int64, tms int64) int

func FcdNoR

func FcdNoR(c0 *BsTr, f *os.File)

FcdNoR deletes a Bstr by a channel requset with no return Donot consider success or not

func FcdNoRRe

func FcdNoRRe(c0 *BsTr, f *os.File, c net.Conn)

FcdNoRRe deletes a Bstr from a net.Conn by a channel request Donot consider success or not

func FcmNoR

func FcmNoR(c0 *BsTr, pagesz, offset int64, f *os.File)

Fcm puts a modified Bstr to io by a channel request with no return Donot consider success or not

func FcmNoRRe

func FcmNoRRe(c0 *BsTr, pagesz, offset int64, f *os.File, c net.Conn)

FcmNoRRe puts a modified Bstr to a net.Conn by a channel requset Donot consider success or not

func FcwNoR

func FcwNoR(c0 *BsTr, pagesz int64, f *os.File)

FcwNoR puts a Bstr to io by a channel request with no return Donot consider success or not

func FcwNoRRe

func FcwNoRRe(c0 *BsTr, pagesz int64, f *os.File, c net.Conn)

FcwRe puts a Bstr to a net.Conn by a channel requset Donot consider success or not

func FileIsReadOnly

func FileIsReadOnly(fn string) (bool, error)

func FreeBsTrtree

func FreeBsTrtree(csp **BsTr, flag uint32, b_destroy_self bool)

should not permit read

func FreeSpire

func FreeSpire(spirep **BsTr)

FreeSpire will set spire to nil will destroy the BsTr tree must be used after End

func FreeTn

func FreeTn(et **BsTr)

FreeTn will destroy the sub BsTr tree of tn without destroying the entry itself must use carefully in multithread env because of writing-to-writing collision carefully*********************************************** TODO: should refuse put and delete __global_tn_conc_map__/__global_pointer_offset_map__ related with the tn

func GCKeySearch

func GCKeySearch[T KeyType](ts []T, t T) int

Add: 20231026 GCKeySearch ruled by containing with sorted data

func GEKeySearch

func GEKeySearch[T KeyType](ts []T, t T) int

func GEKeySearchTms

func GEKeySearchTms[T KeyType](ts []T, t T, tmss []int64, tms int64) int

func GKeySearch

func GKeySearch[T KeyType](ts []T, t T) int

func GKeySearchTms

func GKeySearchTms[T KeyType](ts []T, t T, tmss []int64, tms int64) int

func GPKeySearch

func GPKeySearch[T KeyType](ts []T, t T) int

GPKeySearch ruled by prefix with sorted data

func GSKeySearch

func GSKeySearch[T KeyType](ts []T, t T) int

GSKeySearch ruled by suffix with sorted data

func HttpCenterJsonEngine

func HttpCenterJsonEngine(dep_inject *DepInject, dbsp *BsTr, dbspf *os.File, jdb *JsonDb, re_addr string, s string, notnet_jr *JsonResults) (*JsonDb, *JsonResults, string, error)

HttpCenterJsonEngine process json request from http for operating the JsonDb {"showdbs":""}

func IDxyl

func IDxyl(inittm int64) (int64, int64, int64, int64)

IDxyl is a snowflake algoithm for generating ID return seq==-1 demonstrate 69 years passed

func Intersection

func Intersection(minArg []any, args ...[]any) []any

func IsNumber

func IsNumber(s string) bool

func JiSuanJieGouTiRealLen

func JiSuanJieGouTiRealLen(cs any) int64

JiSuanJieGouTiRealLen computes the real size of Bstr struct The real size is different from the length or the size that will be writen to io

func KeyCmp

func KeyCmp(r, t any) int

KeyCmp compares keys

func KeyCmpTms

func KeyCmpTms(r, t any, rtms, ttms int64) int

KeyCmpTms compares keys and timestamps

func KeyContain

func KeyContain(r, t any) int

Revise: 20231026 KeyContain returns 0 or 1, be true,or else <0, be false

func KeyLen

func KeyLen(key any) int

KeyLen returns the keylen of the key of 5 type

func KeyPrefix

func KeyPrefix(cs *BsTr, r, t any) int

KeyPrefix returns 1, be true,or else <0, be false

func KeyPrefixBi

func KeyPrefixBi(r, t any) int

KeyPrefixBi returns 1, be true,or else <0, be false

func KeyPrefixLi

func KeyPrefixLi(r, t any) int

KeyPrefixLi returns 1, be true,or else <0, be false

func KeySuffix

func KeySuffix(cs *BsTr, r, t any) int

KeySuffix returns 1, be true,or else <0, be false

func KeySuffixBi

func KeySuffixBi(r, t any) int

KeySuffixBi returns 1, be true,or else <0, be false

func KeySuffixLi

func KeySuffixLi(r, t any) int

KeySuffixLi returns 1, be true,or else <0, be false

func LEKeySearch

func LEKeySearch[T KeyType](ts []T, t T) int

func LEKeySearchTms

func LEKeySearchTms[T KeyType](ts []T, t T, tmss []int64, tms int64) int

func LKeySearch

func LKeySearch[T KeyType](ts []T, t T) int

func LKeySearchTms

func LKeySearchTms[T KeyType](ts []T, t T, tmss []int64, tms int64) int

func LevenShtein

func LevenShtein[T StringOrBytesKey](r, t T, inscost, delcost, repcost int) int

func Like

func Like[T KeyType](r T, t T) int

func LocalCenterJsonEngine

func LocalCenterJsonEngine(dbsp *BsTr, dbspf *os.File, jdb *JsonDb, s string, jr *JsonResults) (*JsonDb, *JsonResults, string, error)

LocalCenterJsonEngine process json command for operating the JsonDb when use the package in local

func ModifyDbspUsrPwd

func ModifyDbspUsrPwd(dbsp *BsTr, dbspf *os.File, usr, pwd string)

should only used in single thread, and in db closed condition

func RandomIDxy

func RandomIDxy(inittm int64) (int64, int64, int64, int64)

RandomIDxy is a algoithm for generating random ID

func RandomInt

func RandomInt(maxi int64) int64

RandomInt generates a int64 random number

func Reverse2Dss

func Reverse2Dss(ss []string) []string

func TintersectionT

func TintersectionT[T KeyType](minArg []T, args ...[][]T) []T

func ToBytes

func ToBytes(cs *BsTr, t any) []byte

ToBytes converts data t of golang base type to []byte

func ToBytesBi

func ToBytesBi(t any) []byte

ToBytesBi converts data t of golang base type to []byte

func ToBytesLi

func ToBytesLi(t any) []byte

ToBytesLi converts data t of golang base type to []byte

Types

type BsTr

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

BstrTree input. BsTr implements container for an data-takein object and tree for caching or saving data. BsTr has two mode: normal and nonids. Nonids mode: the id,field,description parameter of base Put* method should be empty, e.g. PutInt64(345345435, "","","").

func Fcd

func Fcd(c0 *BsTr, f *os.File) *BsTr

Fcd deletes a Bstr by a channel requset

func FcdRe

func FcdRe(c0 *BsTr, f *os.File, c net.Conn) *BsTr

FcdRe deletes a Bstr from a net.Conn by a channel request

func Fcm

func Fcm(c0 *BsTr, agosize, pagesz, offset int64, f *os.File) *BsTr

Fcm puts a modified Bstr to io by a channel request

func FcmRe

func FcmRe(c0 *BsTr, pagesz, offset int64, f *os.File, c net.Conn) *BsTr

FcmRe puts a modified Bstr to a net.Conn by a channel requset

func Fco

func Fco(c0 *BsTr, pagesz int64, f *os.File) *BsTr

Fco openup the size of a Bstr by a channel requset

func FcoRe

func FcoRe(c0 *BsTr, pagesz int64, f *os.File, c net.Conn) *BsTr

FcoRe openup the size of a Bstr to a net.Conn by a channel request

func Fcr

func Fcr(offset int64, f *os.File) *BsTr

use channel, not use mutex ikf.go channel file Fcr gets a Bstr from offset by a channel request

func Fcr0

func Fcr0(f *os.File) *BsTr

Fcr0 gets a Bstr from current offset by a channel request

func FcrRe

func FcrRe(offset int64, f *os.File, c net.Conn) *BsTr

FcrRe gets a Bstr from a net.Conn by a channel requset

func Fcrht

func Fcrht(offset int64, f *os.File) *BsTr

Fcrht gets the head and tail of a Bstr from offset by a channel request

func FcrhtRe

func FcrhtRe(offset int64, f *os.File, c net.Conn) *BsTr

FcrhtRe gets the head and tail of a Bstr from a net.Conn by a channel requset

func Fcw

func Fcw(c0 *BsTr, pagesz int64, f *os.File) *BsTr

Fcw puts a Bstr to io by a channel request

func FcwRe

func FcwRe(c0 *BsTr, pagesz int64, f *os.File, c net.Conn) *BsTr

FcwRe puts a Bstr to a net.Conn by a channel requset

func GetFromBufio

func GetFromBufio(r *bufio.Reader) (*BsTr, int64, error)

GetFromBufio gets a Bstr struct from bufio

func GetFromBytes

func GetFromBytes(bs []byte) (*BsTr, int64, error)

GetFromBytes gets a Bstr struct from []byte

func GetFromBytesByBufio

func GetFromBytesByBufio(bs []byte) (*BsTr, int64, error)

GetFromBytesByBufio gets a Bstr struct from []byte using bufio

func GetFromFile

func GetFromFile(f *os.File) (*BsTr, int64, error)

GetFromFile gets a Bstr struct from io loop get often, should seek firstly

func GetFromFileOff

func GetFromFileOff(offset int64, f *os.File) (*BsTr, int64, error)

GetFromFileOff gets a Bstr struct from offset

func GetHeadAndTailFromFileOff

func GetHeadAndTailFromFileOff(offset int64, f *os.File) (*BsTr, error)

GetHeadAndTailFromFileOff gets Bstr head and tail from io

func GetHeadFromBufio

func GetHeadFromBufio(r *bufio.Reader) (*BsTr, error)

GetHeadFromBufio gets the head of Bstr from bufio

func GetHeadFromBytes

func GetHeadFromBytes(bs []byte) (*BsTr, error)

GetHeadFromBytes gets the head of Bstr from []byte

func GetHeadFromFile

func GetHeadFromFile(f *os.File) (*BsTr, error)

GetHeadFromFile gets Bstr head from file must seek first

func GetHeadFromFileOff

func GetHeadFromFileOff(offset int64, f *os.File) (*BsTr, error)

GetHeadFromFileOff gets Bstr head from offset

func InitDbsp

func InitDbsp(auth JsonDbAuthIf) (*BsTr, *os.File)

func Replay

func Replay(oldf, f, oldbinlogf, binlogf *os.File, cif CompressIf) *BsTr

Replay restructs Bstr tree form binlog

func Rescue

func Rescue(cpsts int64, datafn string, binlogf *os.File, cif CompressIf) (*BsTr, *os.File)

Rescue rescue data from a chekcpoint file

func (*BsTr) Assemble

func (cs *BsTr) Assemble(key any) *JsonToken

Assemble implements parser a BsTr datastruct to a JsonToken tree when using with the method, the BsTr must be a json processed with DissembleObj firstly, and after call ToBsTr successfully

func (*BsTr) AssembleBoolJsonTokenTree

func (cs *BsTr) AssembleBoolJsonTokenTree() []*JsonToken

AssembleStrJsonTokenTree assemble a Jsontoken tree for a BsTr embeded-type bools only support beginning of letters IDs or the BsTr datastruct of jsons that begin with object, not array or else, an unforeseen result will be occured

func (*BsTr) AssembleF64JsonTokenTree

func (cs *BsTr) AssembleF64JsonTokenTree() []*JsonToken

AssembleStrJsonTokenTree assemble a Jsontoken tree for a BsTr embeded-type float64s only support beginning of letters IDs or the BsTr datastruct of jsons that begin with object, not array or else, an unforeseen result will be occured

func (*BsTr) AssembleI64JsonTokenTree

func (cs *BsTr) AssembleI64JsonTokenTree() []*JsonToken

AssembleStrJsonTokenTree assemble a Jsontoken tree for a BsTr embeded-type int64s only support beginning of letters IDs or the BsTr datastruct of jsons that begin with object, not array or else, an unforeseen result will be occured

func (*BsTr) AssembleStrJsonTokenTree

func (cs *BsTr) AssembleStrJsonTokenTree() []*JsonToken

AssembleStrJsonTokenTree assemble a Jsontoken tree for a BsTr embeded-type strings only support beginning of letters IDs or the BsTr datastruct of jsons that begin with object, not array or else, an unforeseen result will be occured

func (*BsTr) CGet1

func (cs *BsTr) CGet1(tn string, key any, f *os.File) (*BsTr, int, []any, []bool, []int64, [][]byte, uint32)

Add:20231026

func (*BsTr) CGetAll

func (cs *BsTr) CGetAll(tn string, key any, f *os.File) ([]any, []bool, []int64, [][]byte, uint32)

func (*BsTr) CT

func (cs *BsTr) CT(flag uint32, pagesz int32, maxlevel int8, tn string, f *os.File) (*SpireReturn, error)

func (*BsTr) CTConlonComma

func (cs *BsTr) CTConlonComma(b_jsonnestedtnb bool, flag uint32, pagesz int32, maxlevel int8, tn string, f *os.File) (*SpireReturn, error)

func (*BsTr) CheckBT

func (cs *BsTr) CheckBT(bn, tn string) bool

CheckBT checks bn and tn are named legally or not

func (*BsTr) CheckBTExisted

func (cs *BsTr) CheckBTExisted() bool

CheckBTExisted checks bn and tn existed or not

func (*BsTr) CheckDELETEFlag

func (cs *BsTr) CheckDELETEFlag() bool

CheckDELETEFlag checks bit 15

func (*BsTr) CheckFlagAndLen

func (cs *BsTr) CheckFlagAndLen() bool

CheckFlagAndLen checks flag and lens mapped flag

func (*BsTr) CheckID

func (cs *BsTr) CheckID(ID string) (bool, IntLens, any)

CheckID checks ID existed or not

func (*BsTr) CheckLen

func (cs *BsTr) CheckLen() (int64, bool)

CheckLen checks cs.length

func (*BsTr) CheckLens

func (cs *BsTr) CheckLens() bool

CheckLens checks cs.lens Lens of a Bstr different from flag. Lens stats 15 types of golang, and also stats fields bsk/offs/tms of a Bstr

func (*BsTr) CheckType

func (cs *BsTr) CheckType(key string) bool

CheckType checks the data of all type existed in a Bstr or not with ID contained the parameter key

func (*BsTr) CheckTypeOne

func (cs *BsTr) CheckTypeOne(l IntLens, key string, n_str *[]string) bool

CheckTypeOne checks the data of a type existed in a Bstr or not with ID contained the parameter key

func (*BsTr) Close

func (cs *BsTr) Close()

Close only close log_file and call sStopfFunc sStopfFunc will stop file operations with prefix Fc in iffunc.go _fFunc() in iffunc.go guarantee one file operation per request

func (*BsTr) Copy

func (cs *BsTr) Copy(dstcs *BsTr)

Copy copy Bstr deeply copy cs to dstcs only copy parts in length that write to a file or a net.Conn

func (*BsTr) Del

func (cs *BsTr) Del(tn string, key any, f, binlogf *os.File, logc net.Conn) (any, error)

Del delete data related with the key in unique mode

func (*BsTr) Del4NotUnique

func (cs *BsTr) Del4NotUnique(tn string, key any, tms4del int64, f, binlogf *os.File, logc net.Conn) (any, error)

Del4NotUnique delete data related with the key and timestamp in not-unique mode Add:20231026

func (*BsTr) DelByJsonParser

func (embedspire *BsTr) DelByJsonParser(arr_or_obj JsonTokenType, jdt *JsonDt, tn, embedtn string, jp *JsonParser, f, binlogf *os.File, logc net.Conn) error

DelByJsonParser delete a json data in JsonDt by a jsonparser related with a json

func (*BsTr) DelJson

func (embedspire *BsTr) DelJson(jdt *JsonDt, tn, embedtn, s string, f, binlogf *os.File, logc net.Conn) error

DelJson delete the json data that was put into a JsonDt with a unique key

func (*BsTr) Delete

func (cs *BsTr) Delete(data_type_sn int8, q int, i int) error

Collapse deletes q elements started from i for one data_type_sn

func (*BsTr) DeleteWithDes

func (cs *BsTr) DeleteWithDes(key string, c bool) error

DeleteWithDes deletes a elements in a Bstr with description(parameter key)

func (*BsTr) DeleteWithField

func (cs *BsTr) DeleteWithField(key string, c bool) error

DeleteWithField deletes a elements in a Bstr with field(parameter key)

func (*BsTr) DeleteWithID

func (cs *BsTr) DeleteWithID(key string, c bool) error

only can delete base type[BOOLSN-BYTESN] and in !noids mode DeleteWithID deletes a elements in a Bstr with ID(parameter key)

func (*BsTr) DeleteWithKeyOneType

func (cs *BsTr) DeleteWithKeyOneType(l IntLens, key string, n_str *[]string, bsbase string, step IntLens, c bool) bool

DeleteWithKeyOneType deletes a elements with parameter key. Key can be ID, field or description

func (*BsTr) Drop

func (cs *BsTr) Drop(otherspire, currentspire *BsTr, flag uint32, f *os.File)

func (*BsTr) ElementsToBytes

func (cs *BsTr) ElementsToBytes(buf *bytes.Buffer) error

func (*BsTr) End

func (cs *BsTr) End(bForcePersis bool, f *os.File)

End ends a round operaitons of a Bstr tree Can not be reentrant Must reboot the process for beginning Start bForcePersis only for MEM mode must restart process

func (*BsTr) End4Reentry

func (cs *BsTr) End4Reentry(f *os.File)

End4Reentry clear global maps that must be cleared for reenter Can be reentrant spire will be readonly in memory, but can reenter for writing

func (*BsTr) End4ReentryAndPersis

func (cs *BsTr) End4ReentryAndPersis(bForcePersis bool, f *os.File)

End4ReentryAndPersis implements End function without stop global goroutines but stop tn goroutines spire will be readonly in memory, but can reenter for writing

func (*BsTr) EndOnlyPersis

func (cs *BsTr) EndOnlyPersis(bForcePersis bool, f *os.File)

EndOnlyPersis ends a round operaitons of a Bstr tree, but only persis Can be reentrant

func (*BsTr) Expand

func (cs *BsTr) Expand(data_type_sn int8, q int, i int) error

Expand expands number of q elements started from i

func (*BsTr) FindContainsOrCompareDes

func (cs *BsTr) FindContainsOrCompareDes(des string, re_cs *BsTr, c bool)

FindContainsOrCompareField find the data of all type existed in a Bstr or not with description contained or equal the parameter key key can "" c true,not precise c false,precise

func (*BsTr) FindContainsOrCompareField

func (cs *BsTr) FindContainsOrCompareField(field string, re_cs *BsTr, c bool)

FindContainsOrCompareField find the data of all type existed in a Bstr or not with field contained or equal the parameter key key can "" c true,not precise c false,precise

func (*BsTr) FindContainsOrCompareID

func (cs *BsTr) FindContainsOrCompareID(key string, re_cs *BsTr, c bool)

FindContainsOrCompareID find the data of all type existed in a Bstr or not with ID contained or equal the parameter key key can "" c true,not precise c false,precise

func (*BsTr) FindContainsOrCompareKeyOneType

func (cs *BsTr) FindContainsOrCompareKeyOneType(l IntLens, key string, n_str *[]string, bsbase string, re_cs *BsTr, step IntLens, c bool)

FindContainsOrCompareKeyOneType find the data of a type existed in a Bstr or not with ID/field/description contained or equal the parameter key The results stored in parameter re_cs

func (*BsTr) Flag

func (cs *BsTr) Flag() uint16

Flag returns the flag of Bstr The flag is a uint16. Bit 1-15(bool int8 int16 int32 int64 .... string []byte, exclude base type rune) demonstrates base types of a Bstr included. Bit 16:delete flag.

func (*BsTr) Get

func (cs *BsTr) Get(bPrecise bool, tn string, key any, f *os.File) ([]any, []bool, []int64, [][]byte, uint32)

Get gets data from a Bstr tree by a key precisely or not

func (*BsTr) Get1OrAll

func (cs *BsTr) Get1OrAll(flag int8, tn string, key any, f *os.File) ([]any, []bool, []int64, [][]byte, uint32)

GetB gets data from a Bstr tree by a key with bit flag:GETEQUAL,GETCONTAIN,GETPREFIX,GETSUFFIX

func (*BsTr) GetAnyByKey

func (cs *BsTr) GetAnyByKey(key string, s any) error

************************************************** base Get* operations of Bstr struct different from Get operation of Bstr tree ************************************************** GetAnyByKey gets any data from a Bstr with a key. The key is a unique id generated by snowflake algorithm or els. key can "". When key is empty, only gets nonkey-related data.

func (*BsTr) GetBase

func (cs *BsTr) GetBase(ID string) any

GetBase gets data of 15 golang base type by ID when type is []byte, should copy return value

func (*BsTr) GetBaseReturnIndexAndSN

func (cs *BsTr) GetBaseReturnIndexAndSN(ID string) (int, int)

GetBaseReturnIndexAndSN gets data index and bit-sn at flag of a Bstr by ID

func (*BsTr) GetBool

func (cs *BsTr) GetBool(ID string) (*bool, IntLens)

GetBool get the pointer of bool value and index by ID

func (*BsTr) GetBoolFieldDes

func (cs *BsTr) GetBoolFieldDes(ID string) (string, string)

GetBoolFieldDes get the filed and des by ID

func (*BsTr) GetBs

func (chunki *BsTr) GetBs(flag uint32, index int, bss [][]byte, f *os.File) [][]byte

func (*BsTr) GetBytes

func (cs *BsTr) GetBytes(ID string) (*[]byte, IntLens)

should copy out

func (*BsTr) GetBytesFieldDes

func (cs *BsTr) GetBytesFieldDes(ID string) (string, string)

func (*BsTr) GetChunks

func (cs *BsTr) GetChunks() []*BsTr

func (*BsTr) GetChunksFromIgnoreIndex

func (cs *BsTr) GetChunksFromIgnoreIndex() []*BsTr

func (*BsTr) GetComplex128

func (cs *BsTr) GetComplex128(ID string) (*complex128, IntLens)

func (*BsTr) GetComplex128FieldDes

func (cs *BsTr) GetComplex128FieldDes(ID string) (string, string)

func (*BsTr) GetComplex64

func (cs *BsTr) GetComplex64(ID string) (*complex64, IntLens)

func (*BsTr) GetComplex64FieldDes

func (cs *BsTr) GetComplex64FieldDes(ID string) (string, string)

func (*BsTr) GetEmbedSpire

func (cs *BsTr) GetEmbedSpire(tn string, embedtn string, f *os.File) (string, *BsTr, *SpireReturn)

GetEmbedSpire get the nested spire

func (*BsTr) GetFieldDes

func (cs *BsTr) GetFieldDes(ID string) (string, string)

GetFieldDes gets field and description by ID

func (*BsTr) GetFloat32

func (cs *BsTr) GetFloat32(ID string) (*float32, IntLens)

func (*BsTr) GetFloat32FieldDes

func (cs *BsTr) GetFloat32FieldDes(ID string) (string, string)

func (*BsTr) GetFloat64

func (cs *BsTr) GetFloat64(ID string) (*float64, IntLens)

func (*BsTr) GetFloat64FieldDes

func (cs *BsTr) GetFloat64FieldDes(ID string) (string, string)

func (*BsTr) GetInt16

func (cs *BsTr) GetInt16(ID string) (*int16, IntLens)

func (*BsTr) GetInt16FieldDes

func (cs *BsTr) GetInt16FieldDes(ID string) (string, string)

func (*BsTr) GetInt32

func (cs *BsTr) GetInt32(ID string) (*int32, IntLens)

func (*BsTr) GetInt32FieldDes

func (cs *BsTr) GetInt32FieldDes(ID string) (string, string)

func (*BsTr) GetInt64

func (cs *BsTr) GetInt64(ID string) (*int64, IntLens)

func (*BsTr) GetInt64FieldDes

func (cs *BsTr) GetInt64FieldDes(ID string) (string, string)

func (*BsTr) GetInt8

func (cs *BsTr) GetInt8(ID string) (*int8, IntLens)

func (*BsTr) GetInt8FieldDes

func (cs *BsTr) GetInt8FieldDes(ID string) (string, string)

func (*BsTr) GetString

func (cs *BsTr) GetString(ID string) (*string, IntLens)

func (*BsTr) GetStringFieldDes

func (cs *BsTr) GetStringFieldDes(ID string) (string, string)

func (*BsTr) GetTotal

func (cs *BsTr) GetTotal() int

GetTotal return sum of cs.lens

func (*BsTr) GetUint16

func (cs *BsTr) GetUint16(ID string) (*uint16, IntLens)

func (*BsTr) GetUint16FieldDes

func (cs *BsTr) GetUint16FieldDes(ID string) (string, string)

func (*BsTr) GetUint32

func (cs *BsTr) GetUint32(ID string) (*uint32, IntLens)

func (*BsTr) GetUint32FieldDes

func (cs *BsTr) GetUint32FieldDes(ID string) (string, string)

func (*BsTr) GetUint64

func (cs *BsTr) GetUint64(ID string) (*uint64, IntLens)

func (*BsTr) GetUint64FieldDes

func (cs *BsTr) GetUint64FieldDes(ID string) (string, string)

func (*BsTr) GetUint8

func (cs *BsTr) GetUint8(ID string) (*uint8, IntLens)

func (*BsTr) GetUint8FieldDes

func (cs *BsTr) GetUint8FieldDes(ID string) (string, string)

func (*BsTr) HaveBool

func (cs *BsTr) HaveBool() bool

func (*BsTr) HaveBytes

func (cs *BsTr) HaveBytes() bool

func (*BsTr) HaveComplex128

func (cs *BsTr) HaveComplex128() bool

func (*BsTr) HaveComplex64

func (cs *BsTr) HaveComplex64() bool

func (*BsTr) HaveFloat32

func (cs *BsTr) HaveFloat32() bool

func (*BsTr) HaveFloat64

func (cs *BsTr) HaveFloat64() bool

func (*BsTr) HaveInt16

func (cs *BsTr) HaveInt16() bool

func (*BsTr) HaveInt32

func (cs *BsTr) HaveInt32() bool

func (*BsTr) HaveInt64

func (cs *BsTr) HaveInt64() bool

func (*BsTr) HaveInt8

func (cs *BsTr) HaveInt8() bool

func (*BsTr) HaveSring

func (cs *BsTr) HaveSring() bool

func (*BsTr) HaveUint16

func (cs *BsTr) HaveUint16() bool

func (*BsTr) HaveUint32

func (cs *BsTr) HaveUint32() bool

func (*BsTr) HaveUint64

func (cs *BsTr) HaveUint64() bool

func (*BsTr) HaveUint8

func (cs *BsTr) HaveUint8() bool

func (*BsTr) Init

func (cs *BsTr) Init(bn, tn string) bool

Init inits a Bstr struct bn,tn can be blank

func (*BsTr) InitPool

func (cs *BsTr) InitPool(f *os.File)

InitPool init pools ,file write/read/stop chans and page size etc. for using Bstr Use Bstr, must call InitPool or InitPoolWithPageSz firstly

func (*BsTr) InitPoolWithPageSz

func (cs *BsTr) InitPoolWithPageSz(pagesz int64, f *os.File)

InitPoolWithPageSz init pools ,file write/read/stop chans and page size etc. for using Bstr Use Bstr, must call InitPool or InitPoolWithPageSz firstly

func (*BsTr) InitWithLog

func (cs *BsTr) InitWithLog(bn, tn string) bool

InitWithLog inits a Bstr with runing log file Use Bstr: InitPool() firstly and then, Init*() usually *withlog* method should be called once

func (*BsTr) InitWithLogNonids

func (cs *BsTr) InitWithLogNonids(bn, tn string, nonids bool) bool

InitWithLogNonids InitWithLog inits a Bstr with runing log file in Nonids mode *withlog* method should be called once for logging the running info

func (*BsTr) InitWithNonids

func (cs *BsTr) InitWithNonids(bn, tn string, nonids bool) bool

Init inits a Bstr struct in Nonids mode bn,tn can be blank

func (*BsTr) InitWithoutBT

func (cs *BsTr) InitWithoutBT() bool

Init inits a Bstr struct with blank bn and tn

func (*BsTr) IsEmpty

func (cs *BsTr) IsEmpty() bool

IsEmpty judges Bstr is empty or not.

func (*BsTr) IsEmptyFast

func (cs *BsTr) IsEmptyFast() bool

IsEmptyFast judges a Bstr is empty or not

func (*BsTr) LeafIterNext

func (cs *BsTr) LeafIterNext(spr *SpireReturn, f *os.File) (any, []int64, *BsTr)

func (*BsTr) LeafIterStart

func (cs *BsTr) LeafIterStart(tn string, f *os.File) (any, []int64, uint64, *BsTr, *SpireReturn)

return keys,tmss,total,firstleaf,spr

func (*BsTr) Len

func (cs *BsTr) Len() int

be carafully------------------------------------------------------------------------------------------------------------------------------ Len implemets sort.Interface Len

func (*BsTr) LengthToSize

func (cs *BsTr) LengthToSize()

LengthToSize

func (*BsTr) Less

func (cs *BsTr) Less(i, j int) bool

Less implemets sort.Interface Less

func (*BsTr) Merge

func (cs *BsTr) Merge(c *BsTr)

Merge merges two Bstr struct Merge c to cs

func (*BsTr) Modify

func (cs *BsTr) Modify(past_size int64, page_size int64, f *os.File) error

Modify modifies a Bstr in io success: return nil, failed: return error not save,cs.size initial =0 past_size is previos cs.size Modify() can replace Save() page_size:current size or a setted page size cs.size>cs.length modify cs.size<cs.lenght append

func (*BsTr) ModifyDeleteFlag

func (cs *BsTr) ModifyDeleteFlag(delete_or_not bool, f *os.File) error

ModifyDeleteFlag modifys the delete flag of a Bstr in file success: return nil, failed: return error

func (*BsTr) MultiEmbededStart

func (cs *BsTr) MultiEmbededStart(size int64, offset int64, f *os.File, binlogf *os.File) (*BsTr, error)

MultiEmbededStart a round operations of a BsTr tree in embeded mode under multithread env

func (*BsTr) MultiEmbededStartAlreadyLoadedFromMem

func (cs *BsTr) MultiEmbededStartAlreadyLoadedFromMem(f *os.File, binlogf *os.File) (*BsTr, error)

MultiEmbededStartAlreadyLoadedFromMem a round operations of a BsTr tree in embeded mode under multithread env the embed chunk had been loaded into mem

func (*BsTr) NiSetDeleteFlag

func (cs *BsTr) NiSetDeleteFlag()

NiSetDeleteFlag sets non-delete flag

func (*BsTr) NidsIdSuffix

func (cs *BsTr) NidsIdSuffix(s string) bool

func (*BsTr) NocheckPutBool

func (cs *BsTr) NocheckPutBool(t bool, ID, field, description string) error

NocheckPutBool do not check ID existed or not

func (*BsTr) NocheckPutBoolI

func (cs *BsTr) NocheckPutBoolI(i int, t bool, ID, field, description string) error

func (*BsTr) NocheckPutBytes

func (cs *BsTr) NocheckPutBytes(t []byte, ID, field, description string) error

func (*BsTr) NocheckPutBytesI

func (cs *BsTr) NocheckPutBytesI(i int, t []byte, ID, field, description string) error

func (*BsTr) NocheckPutComplex128

func (cs *BsTr) NocheckPutComplex128(t complex128, ID, field, description string) error

func (*BsTr) NocheckPutComplex128I

func (cs *BsTr) NocheckPutComplex128I(i int, t complex128, ID, field, description string) error

func (*BsTr) NocheckPutComplex64

func (cs *BsTr) NocheckPutComplex64(t complex64, ID, field, description string) error

func (*BsTr) NocheckPutComplex64I

func (cs *BsTr) NocheckPutComplex64I(i int, t complex64, ID, field, description string) error

func (*BsTr) NocheckPutFloat32

func (cs *BsTr) NocheckPutFloat32(t float32, ID, field, description string) error

func (*BsTr) NocheckPutFloat32I

func (cs *BsTr) NocheckPutFloat32I(i int, t float32, ID, field, description string) error

func (*BsTr) NocheckPutFloat64

func (cs *BsTr) NocheckPutFloat64(t float64, ID, field, description string) error

func (*BsTr) NocheckPutFloat64I

func (cs *BsTr) NocheckPutFloat64I(i int, t float64, ID, field, description string) error

func (*BsTr) NocheckPutInt16

func (cs *BsTr) NocheckPutInt16(t int16, ID, field, description string) error

func (*BsTr) NocheckPutInt16I

func (cs *BsTr) NocheckPutInt16I(i int, t int16, ID, field, description string) error

func (*BsTr) NocheckPutInt32

func (cs *BsTr) NocheckPutInt32(t int32, ID, field, description string) error

func (*BsTr) NocheckPutInt32I

func (cs *BsTr) NocheckPutInt32I(i int, t int32, ID, field, description string) error

func (*BsTr) NocheckPutInt64

func (cs *BsTr) NocheckPutInt64(t int64, ID, field, description string) error

func (*BsTr) NocheckPutInt64I

func (cs *BsTr) NocheckPutInt64I(i int, t int64, ID, field, description string) error

func (*BsTr) NocheckPutInt8

func (cs *BsTr) NocheckPutInt8(t int8, ID, field, description string) error

func (*BsTr) NocheckPutInt8I

func (cs *BsTr) NocheckPutInt8I(i int, t int8, ID, field, description string) error

func (*BsTr) NocheckPutString

func (cs *BsTr) NocheckPutString(t string, ID, field, description string) error

func (*BsTr) NocheckPutStringI

func (cs *BsTr) NocheckPutStringI(i int, t string, ID, field, description string) error

func (*BsTr) NocheckPutUint16

func (cs *BsTr) NocheckPutUint16(t uint16, ID, field, description string) error

func (*BsTr) NocheckPutUint16I

func (cs *BsTr) NocheckPutUint16I(i int, t uint16, ID, field, description string) error

func (*BsTr) NocheckPutUint32

func (cs *BsTr) NocheckPutUint32(t uint32, ID, field, description string) error

func (*BsTr) NocheckPutUint32I

func (cs *BsTr) NocheckPutUint32I(i int, t uint32, ID, field, description string) error

func (*BsTr) NocheckPutUint64

func (cs *BsTr) NocheckPutUint64(t uint64, ID, field, description string) error

func (*BsTr) NocheckPutUint64I

func (cs *BsTr) NocheckPutUint64I(i int, t uint64, ID, field, description string) error

func (*BsTr) NocheckPutUint8

func (cs *BsTr) NocheckPutUint8(t uint8, ID, field, description string) error

func (*BsTr) NocheckPutUint8I

func (cs *BsTr) NocheckPutUint8I(i int, t uint8, ID, field, description string) error

func (*BsTr) NocheckUpdBoolI

func (cs *BsTr) NocheckUpdBoolI(i int, t bool, ID, field, description string) error

func (*BsTr) NocheckUpdBytesI

func (cs *BsTr) NocheckUpdBytesI(i int, t []byte, ID, field, description string) error

func (*BsTr) NocheckUpdComplex128I

func (cs *BsTr) NocheckUpdComplex128I(i int, t complex128, ID, field, description string) error

func (*BsTr) NocheckUpdComplex64I

func (cs *BsTr) NocheckUpdComplex64I(i int, t complex64, ID, field, description string) error

func (*BsTr) NocheckUpdFloat32I

func (cs *BsTr) NocheckUpdFloat32I(i int, t float32, ID, field, description string) error

func (*BsTr) NocheckUpdFloat64I

func (cs *BsTr) NocheckUpdFloat64I(i int, t float64, ID, field, description string) error

func (*BsTr) NocheckUpdInt16I

func (cs *BsTr) NocheckUpdInt16I(i int, t int16, ID, field, description string) error

func (*BsTr) NocheckUpdInt32I

func (cs *BsTr) NocheckUpdInt32I(i int, t int32, ID, field, description string) error

func (*BsTr) NocheckUpdInt64I

func (cs *BsTr) NocheckUpdInt64I(i int, t int64, ID, field, description string) error

func (*BsTr) NocheckUpdInt8I

func (cs *BsTr) NocheckUpdInt8I(i int, t int8, ID, field, description string) error

func (*BsTr) NocheckUpdStringI

func (cs *BsTr) NocheckUpdStringI(i int, t string, ID, field, description string) error

func (*BsTr) NocheckUpdUint16I

func (cs *BsTr) NocheckUpdUint16I(i int, t uint16, ID, field, description string) error

func (*BsTr) NocheckUpdUint32I

func (cs *BsTr) NocheckUpdUint32I(i int, t uint32, ID, field, description string) error

func (*BsTr) NocheckUpdUint64I

func (cs *BsTr) NocheckUpdUint64I(i int, t uint64, ID, field, description string) error

func (*BsTr) NocheckUpdUint8I

func (cs *BsTr) NocheckUpdUint8I(i int, t uint8, ID, field, description string) error

func (*BsTr) Nonids

func (cs *BsTr) Nonids() bool

func (*BsTr) Offset

func (cs *BsTr) Offset() int64

Offset returns the offset of a Bstr in io

func (*BsTr) OpenupSpace

func (cs *BsTr) OpenupSpace(page_size int64, f *os.File) error

OpenupSpace openup space of cs.Size in io and get the offset of a Bstr in io

func (*BsTr) Plb

func (cs *BsTr) Plb(flag uint32, f *os.File, printBigData bool)

Plb prints a Bstr tree recursively

func (*BsTr) Print

func (cs *BsTr) Print()

******************************************************************************************* Print prints a Bstr struct

func (*BsTr) Put

func (cs *BsTr) Put(ops int8, tn string, key any, Dts any, tag string, f, binlogf *os.File, logc net.Conn, cif CompressIf, tms4notunique int64) (any, error)

Put puts data to a Bstr tree by a key. BstrTree Put, different from Put* operatiorns of Bstr struct. Support key of 5 types:string/[]byte/complex128/int64/float64. Only use channel and goroutines to guarantee thread safe. The BstrTree can wander between memory and disk.

**********************************************************

THE BSTRTREE CAN WANDER BETWEEN MEMORY AND DISK
SUPPORT KEY OF 5 TYPES:STRING/[]BYTE/COMPLEX128/INT64/FLOAT64
DIFFERENCE BETWEEN MEM MODE AND NON-MEM MODE: NON-MEM MODE WRITE ALL OPERATION TO DISK, MEM MODE NOT.
DO NOT RECOMMEND COMPRESS | BIG
BECAUSE DATA WAS COMPRESSED, WILL MAY NOT SATISFY BIG MODE.
UNIQUE: UNIQUE KEY
STRKEY: STRING TYPE KEY
NOSERIAL: NOT SERIALIZE DATA.  SERIAL MODE: SERIALIZE DATA TO A BSTR STRUCT FIRSTLY.
BIG: BIG DATA MODE
FILEBIG: BIG DATA SAVE TO FILE, INCLUDE BIGDATA NOT USE BIG MODE. BE CAREFULLY, WHEN READ, MAYBE OOM.
NUMBERED: SORTED DATA NO.
COMPRESS: COMPRESS DATA
NULLKEY: KEY IS NULL, NOT AVAILABLE CURRENTLY.
I64KEY: INT64 KEY
F64KEY: FLOAT64 KEY
C128KEY: COMPLEX128 KEY
BSKEY: []BYTE KEY
NULL: KEY CAN NULL,NOT NULLKEY
EMBEDED: EMBEDED MODE, A DB AS A KEY-DATA
MEM: memory mode, collide with FILEBIG

----------------------------------------------------------- Example as StrKey composite:

UNIQUE|STRKEY|NOSERIAL
UNIQUE|STRKEY|NOSERIAL|BIG
UNIQUE|STRKEY
UNIQUE|STRKEY|BIG
UNIQUE|STRKEY|NOSERIAL|FILEBIG
UNIQUE|STRKEY|NOSERIAL|BIG|FILEBIG
UNIQUE|STRKEY|FILEBIG
UNIQUE|STRKEY|BIG|FILEBIG
STRKEY|NOSERIAL
STRKEY|NOSERIAL|BIG
STRKEY
STRKEY|BIG
STRKEY|NOSERIAL|FILEBIG
STRKEY|NOSERIAL|BIG|FILEBIG
STRKEY|FILEBIG
STRKEY|BIG|FILEBIG
NUMBERED|UNIQUE|STRKEY|NOSERIAL|BIG
NUMBERED|UNIQUE|STRKEY
NUMBERED|UNIQUE|STRKEY|BIG
NUMBERED|UNIQUE|STRKEY|NOSERIAL|FILEBIG
NUMBERED|UNIQUE|STRKEY|NOSERIAL|BIG|FILEBIG
NUMBERED|UNIQUE|STRKEY|FILEBIG
NUMBERED|UNIQUE|STRKEY|BIG|FILEBIG
NUMBERED|STRKEY|NOSERIAL
NUMBERED|STRKEY|NOSERIAL|BIG
NUMBERED|STRKEY
NUMBERED|STRKEY|BIG
NUMBERED|STRKEY|NOSERIAL|FILEBIG
NUMBERED|STRKEY|NOSERIAL|BIG|FILEBIG
NUMBERED|STRKEY|FILEBIG
NUMBERED|STRKEY|BIG|FILEBIG
COMPRESS|UNIQUE|STRKEY|NOSERIAL
COMPRESS|UNIQUE|STRKEY|NOSERIAL|BIG
COMPRESS|UNIQUE|STRKEY
COMPRESS|UNIQUE|STRKEY|BIG
COMPRESS|UNIQUE|STRKEY|NOSERIAL|FILEBIG
COMPRESS|UNIQUE|STRKEY|NOSERIAL|BIG|FILEBIG
COMPRESS|UNIQUE|STRKEY|FILEBIG
COMPRESS|UNIQUE|STRKEY|BIG|FILEBIG
COMPRESS|STRKEY|NOSERIAL
COMPRESS|STRKEY|NOSERIAL|BIG
COMPRESS|STRKEY
COMPRESS|STRKEY|BIG
COMPRESS|STRKEY|NOSERIAL|FILEBIG
COMPRESS|STRKEY|NOSERIAL|BIG|FILEBIG
COMPRESS|STRKEY|FILEBIG
COMPRESS|STRKEY|BIG|FILEBIG
COMPRESS|NUMBERED|UNIQUE|STRKEY|NOSERIAL|BIG
COMPRESS|NUMBERED|UNIQUE|STRKEY
COMPRESS|NUMBERED|UNIQUE|STRKEY|BIG
COMPRESS|NUMBERED|UNIQUE|STRKEY|NOSERIAL|FILEBIG
COMPRESS|NUMBERED|UNIQUE|STRKEY|NOSERIAL|BIG|FILEBIG
COMPRESS|NUMBERED|UNIQUE|STRKEY|FILEBIG
COMPRESS|NUMBERED|UNIQUE|STRKEY|BIG|FILEBIG
COMPRESS|NUMBERED|STRKEY|NOSERIAL
COMPRESS|NUMBERED|STRKEY|NOSERIAL|BIG
COMPRESS|NUMBERED|STRKEY
COMPRESS|NUMBERED|STRKEY|BIG
COMPRESS|NUMBERED|STRKEY|NOSERIAL|FILEBIG
COMPRESS|NUMBERED|STRKEY|NOSERIAL|BIG|FILEBIG
COMPRESS|NUMBERED|STRKEY|FILEBIG
COMPRESS|NUMBERED|STRKEY|BIG|FILEBIG
UNIQUE|STRKEY|NOSERIAL|EMBEDED
...

**********************************************************

Revise:20231026 add tms4notunique

func (*BsTr) PutAnyByKey

func (cs *BsTr) PutAnyByKey(s any, fu_type_str string, tag string, key *string, inittm int64) (string, error)

PutAnyByKey can put any data to a Bstr struct support most data type: struct, map[base type]any ,slice and golang base type fu_type_str be empty best inittm used by generating key for parsing the data to original pattern example as follows: data:

type AUU struct {
	Ass  [3]string        `json:"auuuss"`
	Afff [3][2][1]float32 `json:"auuufff"`
}
type UUU struct {
	Ass  [3]string              `json:"uuuss"`
	Afff [3][2][1]float32       `json:"uuufff"`
	Aam  map[string]int         `json:"uuuam"`
	Am   map[string]map[int]int `json:"uuum"`
	Ac   complex128             `json:"uuuc"`
	Puu  *UU                    `json:"uu"`
	AUU
}
type UU struct {
	Abool bool
	Ai8   int8
	Ai16  int16
	Ai32  int32
	Ai64  int64
	Ai    int
	Aui8  uint8
	Aui16 uint16
	Aui32 uint32
	Aui64 uint64
	Aui   uint
	As    string
	Ab    [][]byte  `json:"b"`
	Ass   [3]string `json:"ss"`
	Afff  [3][2][1]float32
	Aam   map[string]int         `json:"am"`
	Am    map[string]map[int]int `json:"m"`
	Ac    complex128             `json:"c"`
	Auuu  UUU                    `json:"uuu"`
}

m := make(map[string]map[int]int) mi := make(map[int]int) mo := make(map[int]int) m["roytoyi"] = mi m["poouyyy"] = mo mi[9] = 100 mo[10] = 1000 ms := make(map[string]int) ms["dfgdg"] = 100000

uu := UU{
	true,
	1,
	2,
	3,
	4,
	5,
	6,
	7,
	8,
	9,
	10,
	"sdklfsdk",
	[][]byte{{0}, {1}, {1, 2, 3}, {4, 5, 6, 7, 8}},
	[3]string{"55566", "3454", "234324"},
	[3][2][1]float32{{{11}, {12}}, {{13}, {14}}, {{15}, {16}}},
	ms,
	m,
	23334343 + 45645456i,
	UUU{[3]string{"uuu55566", "uuu3454", "uuu234324"},
		[3][2][1]float32{{{111}, {112}}, {{113}, {114}}, {{115}, {116}}},
		ms,
		m,
		111123334343 + 45645456i,
		nil,
		AUU{[3]string{"auuu55566", "auuu3454", "auuu234324"}, [3][2][1]float32{{{111}, {112}}, {{113}, {114}}, {{115}, {116}}}}},
}

PutAnyByKey result:

{false <nil> [] false false 2006 0 29969 6 6 [17 0 0] [] [] [] [15 0 0 16 0 0 16 0 0 16 0 0 14 0 0 21 0 2 24 0 24 24 0 24 26 0 5 29 0 27 29 0 27] [] [] [] [16 0 0 17 0 0 17 0 0 17 0 0 15 0 0] [] [22 0 0 22 0 0 22 0 0 22 0 0 22 0 0 22 0 0 27 0 6 27 0 6 27 0 6 27 0 6 27 0 6 27 0 6 31 0 7 31 0 7 31 0 7 31 0 7 31 0 7 31 0 7] [] [14 0 1 19 0 4] [14 0 0 17 0 2 17 0 2 17 0 2 22 0 5 22 0 5 22 0 5 26 0 6 26 0 6 26 0 6] [16 0 1 16 0 1 16 0 1 16 0 1] [8 5 4 6 8 7 9 9 8 10] [1 1 3 5] [] [true] [Abool:4eo0b7lgbnq ] [] [] [] [] [] []

[1 2 3 4 5 100000 100 1000 100000 100 1000] [Ai8:4eo0b7lgbnq   Ai16:4eo0b7lgbnq   Ai32:4eo0b7lgbnq   Ai64:4eo0b7lgbnq   Ai:4eo0b7lgbnq   dfgdg:Aam:4eo0b7lgbnq  am 9:roytoyi:Am:4eo0b7lgbnq  m:map[string]map[int]int a:poouyyy:Am:4eo0b7lgbnq  m:map[string]map[int]int dfgdg:Aam:Auuu:4eo0b7lgbnq  uuuam 9:roytoyi:Am:Auuu:4eo0b7lgbnq  uuum:map[string]map[int]int a:poouyyy:Am:Auuu:4eo0b7lgbnq  uuum:map[string]map[int]int] [] [] [] [] [] []
[6 7 8 9 10] [Aui8:4eo0b7lgbnq   Aui16:4eo0b7lgbnq   Aui32:4eo0b7lgbnq   Aui64:4eo0b7lgbnq   Aui:4eo0b7lgbnq  ] [] [] [11 12 13 14 15 16 111 112 113 114 115 116 111 112 113 114 115 116] [0:0:0:Afff:4eo0b7lgbnq   0:1:0:Afff:4eo0b7lgbnq   0:0:1:Afff:4eo0b7lgbnq   0:1:1:Afff:4eo0b7lgbnq   0:0:2:Afff:4eo0b7lgbnq   0:1:2:Afff:4eo0b7lgbnq   0:0:0:Afff:Auuu:4eo0b7lgbnq  uuufff 0:1:0:Afff:Auuu:4eo0b7lgbnq  uuufff 0:0:1:Afff:Auuu:4eo0b7lgbnq  uuufff 0:1:1:Afff:Auuu:4eo0b7lgbnq  uuufff 0:0:2:Afff:Auuu:4eo0b7lgbnq  uuufff 0:1:2:Afff:Auuu:4eo0b7lgbnq  uuufff 0:0:0:Afff:AUU:Auuu:4eo0b7lgbnq  auuufff 0:1:0:Afff:AUU:Auuu:4eo0b7lgbnq  auuufff 0:0:1:Afff:AUU:Auuu:4eo0b7lgbnq  auuufff 0:1:1:Afff:AUU:Auuu:4eo0b7lgbnq  auuufff 0:0:2:Afff:AUU:Auuu:4eo0b7lgbnq  auuufff 0:1:2:Afff:AUU:Auuu:4eo0b7lgbnq  auuufff] [] []

[(2.3334343e+07+4.5645456e+07i) (1.11123334343e+11+4.5645456e+07i)] [Ac:4eo0b7lgbnq c Ac:Auuu:4eo0b7lgbnq uuuc] [sdklfsdk 55566 3454 234324 uuu55566 uuu3454 uuu234324 auuu55566 auuu3454 auuu234324] [As:4eo0b7lgbnq 0:Ass:4eo0b7lgbnq ss 1:Ass:4eo0b7lgbnq ss 2:Ass:4eo0b7lgbnq ss 0:Ass:Auuu:4eo0b7lgbnq uuuss 1:Ass:Auuu:4eo0b7lgbnq uuuss 2:Ass:Auuu:4eo0b7lgbnq uuuss 0:Ass:AUU:Auuu:4eo0b7lgbnq auuuss 1:Ass:AUU:Auuu:4eo0b7lgbnq auuuss 2:Ass:AUU:Auuu:4eo0b7lgbnq auuuss] [[0] [1] [1 2 3] [4 5 6 7 8]] [0:Ab:4eo0b7lgbnq b 1:Ab:4eo0b7lgbnq b 2:Ab:4eo0b7lgbnq b 3:Ab:4eo0b7lgbnq b] [] [] [] 你好 世界 -1 [1 0 0 0 11 0 0 0 5 0 18 0 2 10 4 0 0 0]}

please ckeck the example in i_test.go

func (*BsTr) PutBase

func (cs *BsTr) PutBase(t any, ID string, field string, description string) error

func (*BsTr) PutBaseI

func (cs *BsTr) PutBaseI(i int, t any, ID string, field string, description string) error

func (*BsTr) PutBool

func (cs *BsTr) PutBool(t bool, ID, field, description string) error

func (*BsTr) PutBoolI

func (cs *BsTr) PutBoolI(i int, t bool, ID, field, description string) error

func (*BsTr) PutBsk

func (cs *BsTr) PutBsk(t []byte, s1, s2, s3 string) error

s1,s2,s3 for compatible

func (*BsTr) PutBskI

func (cs *BsTr) PutBskI(i int, t []byte, s1, s2, s3 string) error

s1, s2, s3 string for compatible

func (*BsTr) PutByJsonParser

func (embedspire *BsTr) PutByJsonParser(arr_or_obj JsonTokenType, jdt *JsonDt, tn, embedtn string, jp *JsonParser, f, binlogf *os.File, logc net.Conn, cif CompressIf) error

PutByJsonParser put a json data into tn, and create indexer with fields by a jsonparser related with the json TODO: solve the problem of additial unique field except key, should use a error chan arr for checking, and rollback

func (*BsTr) PutBytes

func (cs *BsTr) PutBytes(t []byte, ID, field, description string) error

func (*BsTr) PutBytesI

func (cs *BsTr) PutBytesI(i int, t []byte, ID, field, description string) error

func (*BsTr) PutChunk

func (cs *BsTr) PutChunk(chunk *BsTr) bool

func (*BsTr) PutChunkI

func (cs *BsTr) PutChunkI(i int, chunk *BsTr) bool

func (*BsTr) PutComplex128

func (cs *BsTr) PutComplex128(t complex128, ID, field, description string) error

func (*BsTr) PutComplex128I

func (cs *BsTr) PutComplex128I(i int, t complex128, ID, field, description string) error

func (*BsTr) PutComplex64

func (cs *BsTr) PutComplex64(t complex64, ID, field, description string) error

func (*BsTr) PutComplex64I

func (cs *BsTr) PutComplex64I(i int, t complex64, ID, field, description string) error

func (*BsTr) PutFloat32

func (cs *BsTr) PutFloat32(t float32, ID, field, description string) error

func (*BsTr) PutFloat32I

func (cs *BsTr) PutFloat32I(i int, t float32, ID, field, description string) error

func (*BsTr) PutFloat64

func (cs *BsTr) PutFloat64(t float64, ID, field, description string) error

func (*BsTr) PutFloat64I

func (cs *BsTr) PutFloat64I(i int, t float64, ID, field, description string) error

func (*BsTr) PutInt

func (cs *BsTr) PutInt(t int, ID, field, description string) error

func (*BsTr) PutInt16

func (cs *BsTr) PutInt16(t int16, ID, field, description string) error

func (*BsTr) PutInt16I

func (cs *BsTr) PutInt16I(i int, t int16, ID, field, description string) error

func (*BsTr) PutInt32

func (cs *BsTr) PutInt32(t int32, ID, field, description string) error

func (*BsTr) PutInt32I

func (cs *BsTr) PutInt32I(i int, t int32, ID, field, description string) error

func (*BsTr) PutInt64

func (cs *BsTr) PutInt64(t int64, ID, field, description string) error

func (*BsTr) PutInt64I

func (cs *BsTr) PutInt64I(i int, t int64, ID, field, description string) error

func (*BsTr) PutInt8

func (cs *BsTr) PutInt8(t int8, ID, field, description string) error

func (*BsTr) PutInt8I

func (cs *BsTr) PutInt8I(i int, t int8, ID, field, description string) error

func (*BsTr) PutIntI

func (cs *BsTr) PutIntI(i int, t int, ID, field, description string) error

func (*BsTr) PutJson

func (embedspire *BsTr) PutJson(jdt *JsonDt, tn, embedtn, s string, f, binlogf *os.File, logc net.Conn, cif CompressIf) error

PutJson put a json data into tn, and create indexer with fields TODO: put error roolback

func (*BsTr) PutOff

func (cs *BsTr) PutOff(t int64) error

func (*BsTr) PutOffI

func (cs *BsTr) PutOffI(i int, t int64) error

func (*BsTr) PutString

func (cs *BsTr) PutString(t string, ID, field, description string) error

func (*BsTr) PutStringI

func (cs *BsTr) PutStringI(i int, t string, ID, field, description string) error

func (*BsTr) PutTm

func (cs *BsTr) PutTm(t int64) error

func (*BsTr) PutTmI

func (cs *BsTr) PutTmI(i int, t int64) error

func (*BsTr) PutUint

func (cs *BsTr) PutUint(t uint, ID, field, description string) error

func (*BsTr) PutUint16

func (cs *BsTr) PutUint16(t uint16, ID, field, description string) error

func (*BsTr) PutUint16I

func (cs *BsTr) PutUint16I(i int, t uint16, ID, field, description string) error

func (*BsTr) PutUint32

func (cs *BsTr) PutUint32(t uint32, ID, field, description string) error

func (*BsTr) PutUint32I

func (cs *BsTr) PutUint32I(i int, t uint32, ID, field, description string) error

func (*BsTr) PutUint64

func (cs *BsTr) PutUint64(t uint64, ID, field, description string) error

func (*BsTr) PutUint64I

func (cs *BsTr) PutUint64I(i int, t uint64, ID, field, description string) error

func (*BsTr) PutUint8

func (cs *BsTr) PutUint8(t uint8, ID, field, description string) error

func (*BsTr) PutUint8I

func (cs *BsTr) PutUint8I(i int, t uint8, ID, field, description string) error

func (*BsTr) PutUintI

func (cs *BsTr) PutUintI(i int, t uint, ID, field, description string) error

func (*BsTr) RT

func (cs *BsTr) RT(tn string, f *os.File) (*SpireReturn, error)

func (*BsTr) RecomputeLen

func (cs *BsTr) RecomputeLen() int64

RecomputeLen recomputes cs.length for write to io

func (*BsTr) Reset

func (cs *BsTr) Reset()

Reset reset a Bstr

func (*BsTr) ResetRetainNonids

func (cs *BsTr) ResetRetainNonids()

Reset reset a Bstr but retains nonids

func (*BsTr) RestatLens

func (cs *BsTr) RestatLens()

RestatLens restats cs.lens

func (*BsTr) ReturnGlobalPageSz

func (cs *BsTr) ReturnGlobalPageSz() int64

ReturnGlobalPageSz returns page size The page size not used by Bstr tree

func (*BsTr) ReturnGlobalRdPool

func (cs *BsTr) ReturnGlobalRdPool() *sync.Pool

ReturnGlobalRdPool returns the __global_read_pool__ for file reading

func (*BsTr) ReturnGlobalWrPool

func (cs *BsTr) ReturnGlobalWrPool() *sync.Pool

ReturnGlobalWrPool returns the __global_write_pool__ for file writing

func (*BsTr) ReturnSNLen

func (cs *BsTr) ReturnSNLen(SN int) int

ReturnSNLen return cs.lens[SN]

func (*BsTr) Rollback

func (cs *BsTr) Rollback(r [MAXSNADD1 + 1]int, i int) error

when put failed, Roolback deletes some elements started from i for some type that has been put

func (*BsTr) Save

func (cs *BsTr) Save(page_size int64, f *os.File) error

Save write cs.length in cs.size to io cs.size<cs.Length, append

func (*BsTr) SaveBufio

func (cs *BsTr) SaveBufio(w *bufio.Writer) error

SaveBufio write cs.length in cs.size to io But not openup space override write, use SaveBufio

func (*BsTr) SetBT

func (cs *BsTr) SetBT(bn, tn string) bool

SetBT sets bn and tn

func (*BsTr) SetC4wr

func (cs *BsTr) SetC4wr(c4wr *sync.Cond)

func (*BsTr) SetDeleteFlag

func (cs *BsTr) SetDeleteFlag()

SetDeleteFlag sets delete flag

func (*BsTr) SetLog

func (cs *BsTr) SetLog(f *os.File)

SetLog changes the log file of runing

func (*BsTr) SetNonids

func (cs *BsTr) SetNonids(nonids bool)

SetNonids sets field nonids of Bstr

func (*BsTr) SetOrder

func (cs *BsTr) SetOrder(order bool)

SetOrder sets big endian or little endian

func (*BsTr) SetPageSz

func (cs *BsTr) SetPageSz(pagesz int64) bool

SetPageSz sets page size temperary

func (*BsTr) SingleEmbededStart

func (cs *BsTr) SingleEmbededStart(size int64, offset int64, f *os.File) (*BsTr, error)

SingleEmbededStart a round operations of a BsTr tree in embeded mode under singlethread env the embed spire chunk should not be loaded into mem

func (*BsTr) SingleEmbededStartAlreadyLoadedFromMem

func (cs *BsTr) SingleEmbededStartAlreadyLoadedFromMem(f *os.File) (*BsTr, error)

SingleEmbededStart a round operations of a BsTr tree in embeded mode under singlethread env the embed spire chunk was loaded into mem

func (*BsTr) SingleEnd

func (cs *BsTr) SingleEnd(bForcePersis bool, f *os.File)

SinlgeEnd end related with SingleStart with single thread mode, equivalent with End in multithread mode

func (*BsTr) SinglePut

func (cs *BsTr) SinglePut(ops int8, tn string, key any, Dts any, tag string, f, binlogf *os.File, logc net.Conn, cif CompressIf, tms4notunique int64) (any, error)

Real Put operation Revise:20231026 add tms4notunique TODO: singlea for singlethread

func (*BsTr) SingleStart

func (cs *BsTr) SingleStart(b_checkpoint bool, f *os.File) (*BsTr, error)

SingleStart a round operations of a BsTr tree in single thread mode with a file,example as a binlog file if checkpoint is true, __global_start_once__ not Do otherwise, start will fail. Because the code "go _groutine_spireFunc()" will not run no TickSave only go left/right/parent/i routines

func (*BsTr) Start

func (cs *BsTr) Start(f *os.File, binlogf *os.File) (*BsTr, *BsTr, error)

Start starts a round operaitons of a Bstr tree initialize spire and entries c4wr must init

func (*BsTr) Swap

func (cs *BsTr) Swap(i, j int)

Swap implements sort.Interface Swap Condition: sort fields' len ==strings' len

func (*BsTr) ToJsonToken

func (cs *BsTr) ToJsonToken() []*JsonToken

func (*BsTr) UpdByJsonParser

func (embedspire *BsTr) UpdByJsonParser(arr_or_obj JsonTokenType, jdt *JsonDt, tn, embedtn string, jp *JsonParser, f, binlogf *os.File, logc net.Conn, cif CompressIf) error

UpdByJsonParser update a json data in JsonDt, and update indexers by a jsonparser related with a json

func (*BsTr) UpdJson

func (embedspire *BsTr) UpdJson(jdt *JsonDt, tn, embedtn, s string, f, binlogf *os.File, logc net.Conn, cif CompressIf) error

UpdJson update a json data in JsonDt, and update indexers

func (*BsTr) UpdateBaseI

func (cs *BsTr) UpdateBaseI(i int, t any, ID string, field string, description string) error

func (*BsTr) UpdateBoolI

func (cs *BsTr) UpdateBoolI(i int, t bool, ID, field, description string) error

func (*BsTr) UpdateBskI

func (cs *BsTr) UpdateBskI(i int, t []byte, s1, s2, s3 string) error

func (*BsTr) UpdateBytesI

func (cs *BsTr) UpdateBytesI(i int, t []byte, ID, field, description string) error

func (*BsTr) UpdateChunkI

func (cs *BsTr) UpdateChunkI(i int, chunk *BsTr) bool

func (*BsTr) UpdateComplex128I

func (cs *BsTr) UpdateComplex128I(i int, t complex128, ID, field, description string) error

func (*BsTr) UpdateComplex64I

func (cs *BsTr) UpdateComplex64I(i int, t complex64, ID, field, description string) error

func (*BsTr) UpdateFloat32I

func (cs *BsTr) UpdateFloat32I(i int, t float32, ID, field, description string) error

func (*BsTr) UpdateFloat64I

func (cs *BsTr) UpdateFloat64I(i int, t float64, ID, field, description string) error

func (*BsTr) UpdateInt16I

func (cs *BsTr) UpdateInt16I(i int, t int16, ID, field, description string) error

func (*BsTr) UpdateInt32I

func (cs *BsTr) UpdateInt32I(i int, t int32, ID, field, description string) error

func (*BsTr) UpdateInt64I

func (cs *BsTr) UpdateInt64I(i int, t int64, ID, field, description string) error

func (*BsTr) UpdateInt8I

func (cs *BsTr) UpdateInt8I(i int, t int8, ID, field, description string) error

func (*BsTr) UpdateIntI

func (cs *BsTr) UpdateIntI(i int, t int, ID, field, description string) error

func (*BsTr) UpdateOffI

func (cs *BsTr) UpdateOffI(i int, t int64) error

func (*BsTr) UpdateOffset

func (cs *BsTr) UpdateOffset(offset int64)

UpdateOffset updates the offset of a Bstr writen in file

func (*BsTr) UpdateSize

func (cs *BsTr) UpdateSize(sz int64) bool

UpdateSize updates the size of a Bstr sz<0,return false sz>=0,but <cs.len,and cs.size<cs.len,cs.size=cs.len,return true other:cs.size=sz,return true

func (*BsTr) UpdateStringI

func (cs *BsTr) UpdateStringI(i int, t string, ID, field, description string) error

func (*BsTr) UpdateTmI

func (cs *BsTr) UpdateTmI(i int, t int64) error

func (*BsTr) UpdateUint16I

func (cs *BsTr) UpdateUint16I(i int, t uint16, ID, field, description string) error

func (*BsTr) UpdateUint32I

func (cs *BsTr) UpdateUint32I(i int, t uint32, ID, field, description string) error

func (*BsTr) UpdateUint64I

func (cs *BsTr) UpdateUint64I(i int, t uint64, ID, field, description string) error

func (*BsTr) UpdateUint8I

func (cs *BsTr) UpdateUint8I(i int, t uint8, ID, field, description string) error

func (*BsTr) UpdateUintI

func (cs *BsTr) UpdateUintI(i int, t uint, ID, field, description string) error

func (*BsTr) WeiInitSaveQian

func (cs *BsTr) WeiInitSaveQian(bn, tn string) bool

WeiInitSaveQian processes: if Bstr not be init, but want save, need call WeiInitSaveQian

type ChildIndexInParentWithAdapter

type ChildIndexInParentWithAdapter func(*BsTr, *BsTr, TreeNodeOrLeafIsEmptyAdapter) int

type CompressIf

type CompressIf interface {
	C([]byte) []byte
	D([]byte) []byte
}

CompressIf is a data compressing interface

type ComputeFreeNumsAdapter

type ComputeFreeNumsAdapter func(*BsTr, *SpireReturn, int, int, bool, int, *BsTr, *os.File) int

type DbspCloseDbParams

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

type DbspCloseDbParams0

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

type DbspUseDbParams

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

type DbspUseDbParams0

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

type DbspUseDbRe

type DbspUseDbRe struct {
	Jdb *JsonDb
	E   error
}

func UseDb

func UseDb(udparams *DbspUseDbParams) *DbspUseDbRe

func UseDb0

func UseDb0(udparams *DbspUseDbParams0) *DbspUseDbRe

type DefaultCIf

type DefaultCIf struct{}

func (DefaultCIf) C

func (dc DefaultCIf) C(d []byte) []byte

C implements a default compress method

func (DefaultCIf) D

func (dc DefaultCIf) D(d []byte) []byte

D implements a default decompress method

type DefaultJsonDbAuth

type DefaultJsonDbAuth struct{}

func (*DefaultJsonDbAuth) Auth

func (djdba *DefaultJsonDbAuth) Auth(dbsp *BsTr, usr string, pwd string) JsonDbSessionIf

type DefaultJsonDbSession

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

func (*DefaultJsonDbSession) GetPwd

func (djdbs *DefaultJsonDbSession) GetPwd() string

func (*DefaultJsonDbSession) GetUsr

func (djdbs *DefaultJsonDbSession) GetUsr() string

type DepInject

type DepInject struct {
	Dbsp  *BsTr
	Dbspf *os.File
	Jdb   *JsonDb
	TmpDep
}

dependency inject struct for http request

type FindConditionParser

type FindConditionParser struct {
	JsonParser //composite normal json parser struct
	// contains filtered or unexported fields
}

FindConditionParser defien a parser struct for finding-condition

func (*FindConditionParser) DissembleObj

func (fcr *FindConditionParser) DissembleObj(parent *FindConditonToken, starti, end int) error

DissembleObj assemble a token tree in a same FindConditonToken pointer slice

func (*FindConditionParser) FcTokening

func (fcr *FindConditionParser) FcTokening() error

FcTokening get tokens of a finding-conditiong string

func (*FindConditionParser) FindGetJsonSpecialGrammaError

func (fcr *FindConditionParser) FindGetJsonSpecialGrammaError() (int, int, string, error)

FindGetJsonSpecialGrammaError detect special gramma errors with __global_FindJsonToken_specialexpect

func (*FindConditionParser) FindGetJsonSpecialGrammaError2

func (fcr *FindConditionParser) FindGetJsonSpecialGrammaError2() (int, int, string, error)

FindGetJsonSpecialGrammaError2 detect special gramma errors with __global_FindJsonToken_specialexpect2

func (*FindConditionParser) GetAFcToken

func (fcr *FindConditionParser) GetAFcToken() (*FindConditonToken, error)

StartGetAFcToken gets a token of a finding-conditiong string

func (*FindConditionParser) GetString

func (fcr *FindConditionParser) GetString() (*FindConditonToken, error)

GetString processes the special stringwith “ of a finding-string, like "{>=`dfdf`}" different from the GetString method in a json parser

func (*FindConditionParser) SetReader

func (fcr *FindConditionParser) SetReader(s string)

SetReader set the string reader and []*FindConditonToken with the composite normal json parser struct

func (*FindConditionParser) StartGetAFcToken

func (fcr *FindConditionParser) StartGetAFcToken() (*FindConditonToken, error)

StartGetAFcToken start tokening for a finding-conditiong string

type FindConditiondTokenType

type FindConditiondTokenType = int

FindConditiondTokenType defination

type FindConditonToken

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

FindConditonToken define a struct of token for finding-condition

type FindParams

type FindParams struct {
	SomeStart func(*FindParams, *os.File) *FindParams // start func for getting page
	Some      func(*FindParams) (*FindParams, *BsTr)  // getting the wanted page
	SomeKeys  func(*FindParams) (*FindParams, []any)
	// contains filtered or unexported fields
}

func (*FindParams) Init

func (fps *FindParams) Init(tn string, spire *BsTr, f *os.File) *FindParams

Init initializes the base params of a FindParams struct

func (*FindParams) SetFindTypeAndKey

func (fps *FindParams) SetFindTypeAndKey(findtype int, key0, key1 any) *FindParams

SetFindTypeAndKey set the find-type, key0 and key1 for finding

func (*FindParams) SetOrientation

func (fps *FindParams) SetOrientation(orientation bool) *FindParams

SetOrientation set the orientation for turning page

func (*FindParams) SetPageShouldHas

func (fps *FindParams) SetPageShouldHas(pageshouldhas int) *FindParams

SetPageShouldHas reset pageshouldhas of the page and reset pageNO-chunk map if the pageshouldhas for setting less than DEFAULTPAGESHOULDHAS, will use default

func (*FindParams) SetSomeFunc

func (fps *FindParams) SetSomeFunc(some FindParamsSome) *FindParams

SetSomeFunc set the Some func of a FindParams struct

func (*FindParams) SetSomeKeysFunc

func (fps *FindParams) SetSomeKeysFunc(somekeys FindParamsSomeKeys) *FindParams

SetSomeKeysFunc set the SomeOnlyKeys func of a FindParams struct

func (*FindParams) SetSomeStartFunc

func (fps *FindParams) SetSomeStartFunc(somestart FindParamsSomeStart) *FindParams

SetSomeStartFunc set the SomeStart func of a FindParams struct

func (*FindParams) SetWantedPage

func (fps *FindParams) SetWantedPage(wantedpageNO int) *FindParams

SetWantedPage set destination pageNO

type FindParamsSome

type FindParamsSome func(*FindParams) (*FindParams, *BsTr)

FindParamsSome declare the Some func for finding

type FindParamsSomeKeys

type FindParamsSomeKeys func(*FindParams) (*FindParams, []any)

type FindParamsSomeStart

type FindParamsSomeStart func(*FindParams, *os.File) *FindParams

FindParamsSomeStart declare the SomeStart func for finding

type FreetreeReturn

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

FreetreeReturn define a result struct for CFREEGET1 or CFREEGETALL by __global_freetreeRe_chan__ return the results must not be used, it will be deadlock

type GetWrLeaf4SplitAdapter

type GetWrLeaf4SplitAdapter func(*BsTr, *SpireReturn, *os.File)

type HttpAuthIf

type HttpAuthIf interface {
	Auth(string, string) HttpSessionIf
}

type HttpSessionIf

type HttpSessionIf interface {
	GetAddr() string
	GetUserId() string
}

type IntBTlen

type IntBTlen int8

type IntBlens

type IntBlens int32

type IntLens

type IntLens int16

type IntNidslen

type IntNidslen int8

type IntSlens

type IntSlens int16

type JsonDb

type JsonDb struct {
	Dbsp, Spire, Ckpcs                     *BsTr
	Dataf_name, Binlogf_name, Logc_ip_port string
	Dbspf, Dataf, Binlogf                  *os.File
	Logc                                   net.Conn
	Jdts                                   sync.Map
	Session                                JsonDbSessionIf
}

func JsonDbInit

func JsonDbInit(W_R bool, dbsp *BsTr, dbspf *os.File, dataf_name, logc_ip_port string, auth JsonDbAuthIf, usr, pwd string) *JsonDb
use Db(only 1 fixed formats):

{"use":{"db":"test","remotelog":"127.0.0.1:9527","readonly":false,"usr":"resob","pwd":"jsonany"}} different JsonDb must use different user name

type JsonDbAuthIf

type JsonDbAuthIf interface {
	Auth(*BsTr, string, string) JsonDbSessionIf
}

type JsonDbSessionIf

type JsonDbSessionIf interface {
	GetUsr() string
	GetPwd() string
}

type JsonDt

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

func (*JsonDt) Del

func (jdt *JsonDt) Del(s string) error

Del implements delete one or more json from a BsTr tree

func (*JsonDt) DelByJsonParser

func (jdt *JsonDt) DelByJsonParser(arr_or_obj JsonTokenType, jstr *JsonParser) error

func (*JsonDt) GetEmbedSpire

func (jdt *JsonDt) GetEmbedSpire(tn string) *JsonDt

func (*JsonDt) Init

func (jdt *JsonDt) Init(f, binlogf *os.File, logc net.Conn, cif CompressIf) *JsonDt

func (*JsonDt) Put

func (jdt *JsonDt) Put(s string) error

Put implements put one or more json into a BsTr tree withkey as follow: i64key format json: {"put":{"key":1234565,"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}}} or strkey format json: {"put":{"key":"1234565","tn":{"field0":num0,"field1":"str0","field2":true,"field3":4356}}} non-key as follow: system will generate a auto-inc-int64 key(or tostring) with tn flag {"put":{"tn":{"field0":num0,"field1":"str0","field2":true,"field3":345}}} bat Put: {"put":[{"key":1234565,"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}},{"key":343453,"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}}]} {"put":[{"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}},{"tn":{"field0":num0,"field1":"str0","field2":true,"field3":1234}}]} TODO:complex128/base64 for []byte

func (*JsonDt) PutAnyJson

func (jdt *JsonDt) PutAnyJson(s string) error

PutAnyJson implements put any json to a tn different format json can be put into a same tn

func (*JsonDt) PutByJsonParser

func (jdt *JsonDt) PutByJsonParser(arr_or_obj JsonTokenType, jstr *JsonParser) error

func (*JsonDt) SetFindJson

func (jdt *JsonDt) SetFindJson(findjson string) *JsonResults

find json gramma:{"Get":{"field0":"{>=10,<=30}","fields":"[field0,field1,field2...]"}} only support: > G >= GE = E < L <= LE < L != NE like "fields" are fields the result included

func (*JsonDt) SetFindJsonParser

func (jdt *JsonDt) SetFindJsonParser(jp *JsonParser) *JsonResults

func (*JsonDt) SetJsonTemplate

func (jdt *JsonDt) SetJsonTemplate(jtml string, b_putany bool) *JsonDt

logic: key:notnull--!bnokey--GetEmbebedSpire--nil--=>call first time--get key--nil:return nil; not nil, type--flag--setTn--nil,return nil;not nil,CTColonComma key:notnull--!bnokey--GetEmbebedSpire--not nil--!putany,return; putany--get key--nil:return nil; not nil, type--flag--compare flag--!=0,return nil;==0,CTColonComma key:null--bnokey--GetEmbebedSpire--nil,return nil;not nil--!putany,return;putany--flag--CTColonComma

func (*JsonDt) SetSpire

func (jdt *JsonDt) SetSpire(spire *BsTr) *JsonDt

spire must inited

func (*JsonDt) SetTemplateByJsonParser

func (jdt *JsonDt) SetTemplateByJsonParser(jp *JsonParser, b_putany bool) *JsonDt

func (*JsonDt) SetTn

func (jdt *JsonDt) SetTn(flag4embededtn uint32, tn string) *JsonDt

func (*JsonDt) Upd

func (jdt *JsonDt) Upd(s string) error

Upd implements update one or more json from a BsTr tree

func (*JsonDt) UpdByJsonParser

func (jdt *JsonDt) UpdByJsonParser(arr_or_obj JsonTokenType, jstr *JsonParser) error

type JsonParser

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

JsonParser define the strcut of a json parser

func PaserClosedbJson

func PaserClosedbJson(s string) (*JsonParser, error)

func PaserClosedbJson0

func PaserClosedbJson0(jstr *JsonParser) (*JsonParser, error)

func PaserUsedbJson

func PaserUsedbJson(s string) (*JsonParser, error)

func PaserUsedbJson1

func PaserUsedbJson1(jstr *JsonParser) (*JsonParser, error)

func (*JsonParser) CheckArrTypeRoute

func (jr *JsonParser) CheckArrTypeRoute() (*JsonToken, *JsonToken, error)

CheckArrTypeRoute checks the token type route of each arr item

func (*JsonParser) DissembleArr

func (jr *JsonParser) DissembleArr(parent *JsonToken, starti, end int) error

DissembleArr assemble a token tree with a same slice of JsonToken pointers recursively

func (*JsonParser) DissembleObj

func (jr *JsonParser) DissembleObj(parent *JsonToken, starti, end int) error

DissembleObj assemble a token tree with a same slice of JsonToken pointers recursively initial state: jr.jts[0],(starti, endi)--(1,len-1)

func (*JsonParser) FindClosedbJsonNormalGrammaError

func (jr *JsonParser) FindClosedbJsonNormalGrammaError() (int, int, string, error)

FindClosedbJsonNormalGrammaError implements finding closedb-json normal errors close Db: {"close":{"db":"test"}}

func (*JsonParser) FindDelJsonNormalGrammaError

func (jr *JsonParser) FindDelJsonNormalGrammaError(tn string) (int, int, string, error)

FindDelJsonNormalGrammaError detect normal gramma errors for a del-json a del-json has a fixed format, as follows:// a del-json with a key: "{\"del\":{\"key\":\"123456\",\"deljsontest\":{}}}" a del-json for bat delting: "{\"del\":[{\"key\":\"123456\",\"deljsontest\":{},{\"key\":\"1234560\",\"deljsontest\":{}]}"

func (*JsonParser) FindGetJsonNormalGrammaError

func (jr *JsonParser) FindGetJsonNormalGrammaError() (int, int, string, error)

FindGetJsonNormalGrammaError detects the normal gramma error of a get-json

func (*JsonParser) FindNormalGrammaError

func (jr *JsonParser) FindNormalGrammaError() (int, int, string, error)

FindNormalGrammaError find normal gramma errors with map:__global_Jsontoken_expect

func (*JsonParser) FindPutJsonNormalGrammaError

func (jr *JsonParser) FindPutJsonNormalGrammaError(tn string) (int, int, string, error)

FindPutJsonNormalGrammaError detect normal gramma errors for a put-json a put-json has a fixed format, as follows: a put-json without a key, sys will generate a key: "{\"put\":{\"putjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}" a put-json with a key: "{\"put\":{\"key\":\"123456\",\"putjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}" a put-json for bat putting: "{\"put\":[{\"key\":\"123456\",\"putjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}},{\"key\":\"1234560\",\"putjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}]}"

func (*JsonParser) FindSetJsonNormalGrammaError

func (jr *JsonParser) FindSetJsonNormalGrammaError(tn string) (int, int, string, error)

FindSetJsonNormalGrammaError detect normal gramma errors for a settempalte-json tml := "{\"set\":{\"key\":123456,\"putjsontest0\":{\"aaa\":\"!\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":1,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}"

func (*JsonParser) FindUpdJsonNormalGrammaError

func (jr *JsonParser) FindUpdJsonNormalGrammaError(tn string) (int, int, string, error)

FindUpdJsonNormalGrammaError detect normal gramma errors for a upd-json a upd-json has a fixed format, as follows:// a upd-json with a key: "{\"upd\":{\"key\":\"123456\",\"updjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}}" a upd-json for bat updting: "{\"upd\":[{\"key\":\"123456\",\"updjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}},{\"key\":\"1234560\",\"updjsontest\":{\"aaa\":\"sdf\tsdfs\\dfe29asdf\",\"aaab\":true,\"arrarrstrct\":{\"nnn\":-1234567890,\"ccc\":[[\"sdf\tsdfs\\dfe29asdf\",\"nmbndfvdfgfdg\"],[\"sdf\tsdfs\\dfe29asdf\",\"poiuiyyttt\"]]},\"ddd\":\"sdf\tsdfs\\dfe29asdf\",\"fff\":false,\"comboolarr\":[{\"boolarr0\":[true,false]},{\"boolarr1\":[true,false]}]}}]}"

func (*JsonParser) FindUsedbJsonNormalGrammaError

func (jr *JsonParser) FindUsedbJsonNormalGrammaError() (int, int, string, error)

FindUsbdbJsonNormalGrammaError implements finding usedb-json normal errors use Db: {"use":{db:"test",remotelog:"127.0.0.1:9527","readonly":true,usr:"resob",pwd:"jsonany"}}

func (*JsonParser) GetAGetJsonToken

func (jr *JsonParser) GetAGetJsonToken() (*JsonToken, error)

GetAGetJsonToken get a token of a get-json

func (*JsonParser) GetAJsonToken

func (jr *JsonParser) GetAJsonToken() (*JsonToken, error)

func (*JsonParser) GetFalse

func (jr *JsonParser) GetFalse() (*JsonToken, error)

GetFalse

func (*JsonParser) GetGetJsonTn

func (jr *JsonParser) GetGetJsonTn() string

func (*JsonParser) GetJsonReader

func (jr *JsonParser) GetJsonReader() *strings.Reader

GetJsonReader

func (*JsonParser) GetJsonTokening

func (jr *JsonParser) GetJsonTokening() error

GetJsonTokening get tokens for a get-json string a get-json is a subset of a normal json why not use normal JsonParser.Tokening?because for permance... format of a get-json as follows: tn or tn.field0 => search key with condition field0:tn => search the value of tn.field0 => get the keys "{\"Get\":{\"tn.field0\":\"{>=0,<=10}\",\"field1:tn\":\"{~`sddsf`}\",\"fields\":\"[`tn.field0`,`tn.field1`,`tn.field2`]\"}}", "{\"Get\":{\"tn.field0\":\"{>=0,>=10}\",\"tn.field1\":\"{>10}\",\"fields\":\"[`tn.field0`,`tn.field1`,`tn.field2`]\"}}", "{\"pet\":{\"tn.field0\":\"{>=`dfdf`}\",\"field1:tn\":\"{=true}\",\"fields\":\"[`tn.field0`,`tn.field1`,`tn.field2`]\"}}", "{\"get\":[{\"field0\":\"{~`djdkjfkdjf`}\",\"fields\":\"[`field3`,`field1`,`field2`]\"}]}",

func (*JsonParser) GetNull

func (jr *JsonParser) GetNull() (*JsonToken, error)

GetNull

func (*JsonParser) GetNumber

func (jr *JsonParser) GetNumber(bread byte) (*JsonToken, error)

GetNumber

func (*JsonParser) GetPutOrUpdOrDelJsonTn

func (jr *JsonParser) GetPutOrUpdOrDelJsonTn() string

func (*JsonParser) GetString

func (jr *JsonParser) GetString() (*JsonToken, error)

GetString donot permit string value with “

func (*JsonParser) GetTokens

func (jr *JsonParser) GetTokens() []*JsonToken

GetTokens

func (*JsonParser) GetTrue

func (jr *JsonParser) GetTrue() (*JsonToken, error)

GetTrue

func (*JsonParser) Print

func (jr *JsonParser) Print()

Print the token tree

func (*JsonParser) SetJsonReader

func (jr *JsonParser) SetJsonReader(r *strings.Reader)

SetJsonReader

func (*JsonParser) SetReader

func (jr *JsonParser) SetReader(s string)

SetReader set the reader from a json string and initialize the slice of a token pointers

func (*JsonParser) StartGetAGetJsonToken

func (jr *JsonParser) StartGetAGetJsonToken() (*JsonToken, error)

StartGetAGetJsonToken start the process of tokening

func (*JsonParser) StartGetAJsonToken

func (jr *JsonParser) StartGetAJsonToken() (*JsonToken, error)

StartGetAJsonToken start the process of tokening

func (*JsonParser) ToBsTr

func (jr *JsonParser) ToBsTr(flag int) *BsTr

ToBsTr get key-vlaues from json, and collect into a Bstr struct value be collect as string,int64,float64,bool,bytes in a BsTr struct null value be stored as a nil []byte

func (*JsonParser) ToNocheckBsTr

func (jr *JsonParser) ToNocheckBsTr(flag int) *BsTr

func (*JsonParser) ToNonidsBsTr

func (jr *JsonParser) ToNonidsBsTr() *BsTr

TODO: GetNumber should subdivide to int8/int16../uint64 float32/float64 complex64/complex128

func (*JsonParser) Tokening

func (jr *JsonParser) Tokening() error

Tokening token a json string, and detect simple errors

type JsonResults

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

func (*JsonResults) GetCurWanPageNO

func (jr *JsonResults) GetCurWanPageNO() (int, int)

func (*JsonResults) Init

func (jr *JsonResults) Init(jdt *JsonDt, keys []any, rp *ResultParser) *JsonResults

func (*JsonResults) IsEnd

func (jr *JsonResults) IsEnd(orientation bool) bool

func (*JsonResults) SetOrientation

func (jr *JsonResults) SetOrientation(orientation bool) *JsonResults

SetOrientation set the orientation for turning page

func (*JsonResults) SetPageShouldHas

func (jr *JsonResults) SetPageShouldHas(pageshouldhas int) *JsonResults

SetPageShouldHas reset pageshouldhas of the page and reset pageNO-chunk map if the pageshouldhas for setting less than DEFAULTPAGESHOULDHAS, will use default

func (*JsonResults) SetWantedPage

func (jr *JsonResults) SetWantedPage(wantedpageNO int) *JsonResults

SetWantedPage set destination pageNO

func (*JsonResults) SomeJsons

func (jr *JsonResults) SomeJsons() (*JsonResults, string)

func (*JsonResults) SomeStart

func (jr *JsonResults) SomeStart() *JsonResults

type JsonToken

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

JsonToken define the struct of parsering a json string when set flag, normal json should avoid keys as follow: const (

JSONDTDATAOPS = "data"
JSONDTPUTOPS  = "put"
JSONDTGETOPS  = "get"
JSONDTKEY     = "key"
JSONDTTN      = "tn"

)

func (*JsonToken) CheckArrTypeRoute

func (jt *JsonToken) CheckArrTypeRoute() (*JsonToken, *JsonToken, error)

func (*JsonToken) GetJsonStr

func (jt *JsonToken) GetJsonStr() string

GetJsonStr get the str of a token

func (*JsonToken) GetTokenType

func (jt *JsonToken) GetTokenType() JsonTokenType

GetTokenType

func (*JsonToken) Print

func (jt *JsonToken) Print()

Print the token tree

func (*JsonToken) SetJsonStr

func (jt *JsonToken) SetJsonStr(jttstr string)

SetJsonStr

func (*JsonToken) SetTokenType

func (jt *JsonToken) SetTokenType(jtt JsonTokenType)

SetTokenType

func (*JsonToken) ToBsTr

func (jt *JsonToken) ToBsTr(colonStr, dotStr string, jsonBstr *BsTr, flag int) (string, string, *BsTr)

ToBsTr get key-vlaues from json, and collect into a Bstr struct key-value format collect in a BsTr struct same as or analogy/compatible with a strcut be put into a BsTr struct when call the PutAnyByKey method as follows: (details about PutAnyByKey in ip.go) can be used by GetAnyByKey method to unserialize to a struct nids[0] format: field:tn(arr is index:tn) nids[1] format: tn.field(arr is tn.index) nids[2] is ""

func (*JsonToken) ToNocheckBsTrs

func (jt *JsonToken) ToNocheckBsTrs(colonStr, dotStr string, jsonBstr *BsTr, flag int) (string, string, *BsTr)

ToNocheckBsTrs for FindJson, maybe has the same field usually, a BsTr struct donot permit same field

func (*JsonToken) ToNonidsBsTr

func (jt *JsonToken) ToNonidsBsTr(jsonBstr *BsTr) *BsTr

ToBsTrBonids get key-vlaues from json, and collect into a Bstr struct with true nonids

type JsonTokenTree

type JsonTokenTree = *JsonToken

func (JsonTokenTree) ToJson

func (jtree JsonTokenTree) ToJson(bstart, bend bool, incs string) string

results json (i64key for example): [{"key":23434}, "tn":{"filed0":"dfd","field1":435,"field2":true,"field3":[{...}]},{"key":345}, "tn":{"filed0":"dfdrtret","field1":45435,"field2":true,"field3":[{...}]}]

type JsonTokenType

type JsonTokenType = int

JsonTokenType defination

type KeyType

type KeyType interface {
	int64 | float64 | complex128 | string | []byte
}

type LastLeafAdapter

type LastLeafAdapter func(*BsTr, *SpireReturn, *os.File) *BsTr

type PageStartBsTrKi

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

type ResultParser

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

func (*ResultParser) FindGetJsonResultGrammaError

func (rp *ResultParser) FindGetJsonResultGrammaError() (int, int, string, error)

func (*ResultParser) GetARpToken

func (rp *ResultParser) GetARpToken() (*ResultToken, error)

StartGetAFcToken gets a token of a finding-conditiong string

func (*ResultParser) GetString

func (rp *ResultParser) GetString() (*ResultToken, error)

func (*ResultParser) RpTokening

func (rp *ResultParser) RpTokening() error

func (*ResultParser) SetReader

func (rp *ResultParser) SetReader(s string)

func (*ResultParser) StartGetARpToken

func (rp *ResultParser) StartGetARpToken() (*ResultToken, error)

StartGetAFcToken start tokening for a finding-conditiong string

type ResultToken

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

type ResultTokenType

type ResultTokenType = int

type SpireReturn

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

SpireReturn struct define the info related with a tn in a BsTr tree

type StringOrBytesKey

type StringOrBytesKey interface {
	string | []byte
}

type TmpDep

type TmpDep struct {
	Jr              *JsonResults
	Session         HttpSessionIf
	Auth            HttpAuthIf
	Jsonresults_map sync.Map
}

type TreeNodeOrLeafIsEmptyAdapter

type TreeNodeOrLeafIsEmptyAdapter func(*BsTr) bool

type UpdateRouteIndexsAdapter

type UpdateRouteIndexsAdapter func(*SpireReturn, int, *os.File)

Jump to

Keyboard shortcuts

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