testutil

package
v0.0.0-...-50414e9 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(txn *badger.Txn) map[string]string

Dump reads all key-value pairs from a transaction and returns them as a map.

func NewRecordStore

func NewRecordStore(prefix []byte) *recstore.Store[int64, SampleRecord, *SampleRecord]

func PrepareTxn

func PrepareTxn(t testing.TB, update bool) *badger.Txn

PrepareTxn creates an in-memory BadgerDB and a transaction for testing.

Types

type SampleRecord

type SampleRecord struct {
	Id   int64  `json:"-"`
	Name string `json:"name,omitempty"`
}

func NewSampleEntity

func NewSampleEntity(name string) *SampleRecord

func (SampleRecord) GetId

func (t SampleRecord) GetId() int64

func (SampleRecord) MarshalBinary

func (t SampleRecord) MarshalBinary() ([]byte, error)

func (*SampleRecord) SetId

func (t *SampleRecord) SetId(id int64)

func (*SampleRecord) UnmarshalBinary

func (t *SampleRecord) UnmarshalBinary(data []byte) error

type SampleStruct

type SampleStruct struct {
	A int            `json:"a,omitempty"`
	B string         `json:"b,omitempty"`
	C bool           `json:"c,omitempty"`
	D []int          `json:"d,omitempty"`
	E map[string]int `json:"e,omitempty"`
	F *SampleStruct  `json:"f,omitempty"`
	G float32        `json:"g,omitempty"`
	H float64        `json:"h,omitempty"`
}

func (SampleStruct) MarshalBinary

func (t SampleStruct) MarshalBinary() ([]byte, error)

func (*SampleStruct) UnmarshalBinary

func (t *SampleStruct) UnmarshalBinary(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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