Пример #1
0
func main() {
	xml := config.NewXmlDecoder("conf/schema.xml")
	for xml.HasNext() {
		name, attr := xml.Next()

		// do some stuff
		_ = name
		_ = attr
	}

	buf := make([]byte, 20)
	util.WriteVint(int64(-1), buf)
	v, _, _ := util.ReadVint(buf)
	fmt.Println("v = ", v)

	name := "testDb"
	kv.Open(&name)
	k := "hello"
	val := "world"
	kv.Put(&k, &val)
	v1, _ := kv.Get(&k)
	println("v1 = ", v1)
	kv.Close()
	_ = f
}
Пример #2
0
func DocInit() {
	once.Do(func() {
		var err error
		name := dbname
		kv.Open(&name)
		appender, err = os.OpenFile(delfile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
		if err != nil {
			panic(err)
		}
		delHandler = syncio.NewSyncFile(delfile)
		if delHandler == nil {
			panic("open SyncFile: " + delfile + " error")
		}
	})
}