lunchordersdb

package
v0.0.0-...-c0abff7 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 3 Imported by: 0

README

Badger DB

In this sample, I played around with the key-value store Badger.

Use this sample to:

  • Learn about Badger
  • Learn basics about Go unit tests

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LunchDB

type LunchDB interface {
	AddItem(table Table, item canSetID) error
	UpdateItem(table Table, item canGetID) error
	GetItem(table Table, id uint64, result interface{}) error
	IterateItems(table Table, process func(value []byte) error) error
	DeleteItem(table Table, id uint64) error
	Close()
}

LunchDB represents a lunchorder database

func Open

func Open(dbDir string) (db LunchDB, err error)

Open opens the lunchorder DB in the given directory

type LunchOrder

type LunchOrder struct {
	ID       uint64 `json:"id,omitempty"`
	Date     uint32 `json:"d"`
	MealID   uint16 `json:"m"`
	PersonID uint32 `json:"p"`
}

LunchOrder represents a lunch order

type Meal

type Meal struct {
	ID     uint64 `json:"id,omitempty"`
	Desc   string `json:"desc"`
	Price  uint32 `json:"price"`
	Active bool   `json:"active,omitempty"`
}

Meal represents a meal that can be ordered

type Person

type Person struct {
	ID        uint64 `json:"id,omitempty"`
	Firstname string `json:"fn"`
	Lastname  string `json:"ln"`
}

Person represents a person ordering lunch

type Table

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

func NewTable

func NewTable(prefix byte) Table

Jump to

Keyboard shortcuts

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