filex

package
v3.0.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: AGPL-3.0 Imports: 6 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(filename string) bool

Exists check if a file is present or not

func Save

func Save(filename string, data interface{}) error

Save writes configs to json file

func WriteIfNotExists

func WriteIfNotExists(filename string, data string) (bool, error)

WriteIfNotExists writes data directly inside file

Types

type BoltStore

type BoltStore struct {
	FileName string
}

BoltStore is a BoltDB implementation of the Store interface

func (*BoltStore) GetConnection

func (b *BoltStore) GetConnection() (*bolt.DB, error)

func (*BoltStore) List

func (b *BoltStore) List(offset uint64, limit uint64) (result []*Version, err error)

List lists all version starting at a given id

func (*BoltStore) Put

func (b *BoltStore) Put(version *Version) error

Put stores version in Bolt

func (*BoltStore) Retrieve

func (b *BoltStore) Retrieve(id uint64) (*Version, error)

Retrieve loads data from db by version ID

type Version

type Version struct {
	Id   uint64
	Date time.Time
	User string
	Log  string
	Data interface{}
}

Version is a structure for encapsulating a new version of configs with additional metadata

type VersionsStore

type VersionsStore interface {
	Put(version *Version) error
	List(offset uint64, limit uint64) ([]*Version, error)
	Retrieve(id uint64) (*Version, error)
}

VersionsStore is the interface for storing and listing configs versions

func NewStore

func NewStore(configDir string) VersionsStore

NewStore opens a new store

Jump to

Keyboard shortcuts

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