args

package
v0.0.0-...-71c6e05 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

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
}

Store holds a mapping between argument keys and values

func GetArgStoresFromCsvRecords

func GetArgStoresFromCsvRecords(records [][]string) (argStores []*Store, err error)

GetArgStoresFromCsvRecords gets a list of records from a CSV file and returns a list

of ArgStores that contain the required arguments to fill out a chronicle.

func NewStore

func NewStore(init StoreInit) (s *Store, err error)

NewStore creates a new ArgStore

func (*Store) Get

func (s *Store) Get(argID string) (value string, keyExists bool)

Get looks up the given key in the ArgStore and returns the value plus a flag indicating whether there is a value for the given key.

func (*Store) GetArray

func (s *Store) GetArray(argID string) (result []string)

GetArray checks the store for array entries with the key as name. Array indices start at 1, not at 0.

func (*Store) GetKeys

func (s *Store) GetKeys() (keyList []string)

GetKeys returns a sorted list of all contained keys

func (*Store) Set

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

Set adds a new value to the ArgStore using the given key.

func (*Store) SetParent

func (s *Store) SetParent(parent *Store) bool

SetParent sets the parent ArgStore for the given ArgStore. The returned bool flag indicates whether an existing parent was overwritten.

type StoreInit

type StoreInit struct {
	InitCapacity int
	Parent       *Store
	Args         []string
}

StoreInit can take parameters for initialisation of an ArgStore object using NewArgStore()

Jump to

Keyboard shortcuts

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