id

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package id list is responsible for id list managing

Index

Constants

This section is empty.

Variables

View Source
var (
	// List is the internal List instancem for 16 bit IDs enough
	List = make(ListT, 0, 65536)

	// FnJSON is the filename of the id list
	FnJSON string

	// Verbose, if set, gives more output information during update
	Verbose bool

	// DryRun, is set, inhibits real changes
	DryRun bool
)

Functions

func Index

func Index(i int, l ListT) (int, error)

Index returns the index of 'ID' inside 'l'. If 'ID' is not inside 'l' Index() returns 0 and an error.

func ScUpdate added in v0.8.2

func ScUpdate() error

ScUpdate is subcommand update

func ScZero added in v0.8.2

func ScZero(SrcZ string, cmd *flag.FlagSet) error

ScZero does replace all ID's in sourc tree with 0

Types

type Item

type Item struct {
	ID      int    `json:"id"`      // identifier
	FmtType string `json:"fmtType"` // format type (bitsize and number of fmt string parameters)
	FmtStrg string `json:"fmtStrg"` // format string
	Created int32  `json:"created"` // utc unix time of creation
	Removed int32  `json:"removed"` // utc unix time of disappearing in processed src directory
}

Item is the basic element

type ListT added in v0.8.2

type ListT []Item

List is a slice type containing the ID list

func (*ListT) FileWatcher added in v0.8.3

func (p *ListT) FileWatcher()

ListFileWatcher checks id list file for changes taken from https://medium.com/@skdomino/watch-this-file-watching-in-go-5b5a247cf71f

func (*ListT) Read added in v0.8.2

func (p *ListT) Read(fn string) error

Read is reading a JSON file fn and returning a slice

func (*ListT) Update added in v0.8.2

func (p *ListT) Update(root, fn string, run, verbose bool) error

Update is parsing source tree root and performing these actions: - replace FmtType( Id(0), ...) with FmtType( Id(n), ...) - find duplicate FmtType( Id(n), ...) and replace one of them if trices are not identical - extend file fnIDList

Jump to

Keyboard shortcuts

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