kv

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package kv implements key-value store that persists data to disk. The process of sending data out of the program is called marshalling. We could marshal Go data into many formats: plain text, base64-encoded text, SQL results or queries, TCP/IP packets, ... The simplest way to format data for transmission is a stream of bytes. This kind of marshalling is called serialization. The encoding/gob package can serialise (most kinds of) Go values to bytes. It creates binary format as opposed to text format like JSON. Adapted from: https://github.com/bitfield/tpg-tools2/tree/main/kv

Level: intermediate Topics: encoding/gob, marshaling, tpg-tools

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

func OpenStore

func OpenStore(path string) (*Store, error)

func (*Store) Get

func (s *Store) Get(key string) (string, bool)

func (*Store) Save

func (s *Store) Save() error

func (*Store) Set

func (s *Store) Set(key, value string)

Jump to

Keyboard shortcuts

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