filex

package
v2.2.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

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
}

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)

Put 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{}
}

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)
}

Interface for storing and listing configs versions

func NewStore

func NewStore(configDir string) VersionsStore

Open a new store

Jump to

Keyboard shortcuts

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