db

package
v0.0.0-...-b22f859 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Copyright (c) 2023, donnie <donnie4w@gmail.com> All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

github.com/donnie4w/tldb

Copyright (c) 2023, donnie <donnie4w@gmail.com> All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

github.com/donnie4w/tldb

Copyright (c) 2023, donnie <donnie4w@gmail.com> All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

github.com/donnie4w/tldb

Copyright (c) 2023, donnie <donnie4w@gmail.com> All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

github.com/donnie4w/tldb

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddObject

func AddObject(_tableKey string, a any)

func AddValue

func AddValue(key string, value []byte) error

func BuildIndex

func BuildIndex[T any]() (err error, _r string)

func DelKey

func DelKey(key string) (err error)

func Delete

func Delete(a any) (err error)

func DeleteWithId

func DeleteWithId[T any](id int64) (err error)

func DeleteWithKey

func DeleteWithKey(table_key string) (err error)

func GetAndSetId

func GetAndSetId[T any](_idx_seq string) (id int64)

func GetIdSeqValue

func GetIdSeqValue[T any]() (id int64)

func GetObjectByOrder

func GetObjectByOrder[T any](_tablename, _idx_id_name string, startId, count int64) (ts []*T)

func GetValue

func GetValue(key string) (value []byte, err error)

func Insert

func Insert(a any) (err error)

func SelectByIdxName

func SelectByIdxName[T any](idx_name, _idx_value string) (_r []*T)

idx_name : index name _idx_value: index value

multiple return

func SelectByIdxNameLimit

func SelectByIdxNameLimit[T any](idx_name string, idxValues []string, startId, limit int64) (_r []*T)

idx_name : index name idxValues: index value array startId : start number limit : maximum return number

func SelectOne

func SelectOne[T any](_id int64) (_r *T)

_id : table id

one return

func SelectOneByIdxName

func SelectOneByIdxName[T any](idx_name, _idx_value string) (_r *T)

idx_name : index name _idx_value: index value

one return

func Selects

func Selects[T any](start, end int64) (_r []*T)

start : table start id end : table end id

func Table

func Table[T any](dbname string) _Table[T]

func Update

func Update(a any) (err error)

Types

type BakStub

type BakStub struct {
	Key   []byte
	Value []byte
}

////////////////////////////////////////////////////////

func RecoverBackup

func RecoverBackup(filename string) (bs []*BakStub)

type DBEngine

type DBEngine interface {
	Open() (err error)
	Close() (err error)
	Has(key []byte) (b bool)
	Put(key, value []byte) (err error)
	Get(key []byte) (value []byte, err error)
	Del(key []byte) (err error)
	GetString(key []byte) (value string, err error)
	Batch(put map[string][]byte, del []string) (err error)
	GetLike(prefix []byte) (datamap map[string][]byte, err error)
	GetKeys() (bys []string, err error)
	GetKeysPrefix(prefix []byte) (bys []string, err error)
	GetKeysPrefixLimit(prefix []byte, limit int) (bys []string, err error)
	GetIterLimit(prefix string, limit string) (datamap map[string][]byte, err error)
}

func New

func New(_dir string) (_r DBEngine)

Jump to

Keyboard shortcuts

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