setlogs

package module
v0.0.0-...-bf74ab4 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DELETE string = "@delete"
View Source
const ID string = "@id"

Variables

This section is empty.

Functions

func OpenFile

func OpenFile(filename string) *os.File

func WriteJSON

func WriteJSON(w io.Writer, setlog SetLog)

Types

type Record

type Record map[string]string

func Filter

func Filter(records []Record, exist func(r Record) bool) []Record

func FilterByID

func FilterByID(records []Record, id_set Set) []Record

func NewRecord

func NewRecord() Record

func (Record) SetDelete

func (r Record) SetDelete(del bool)

type Set

type Set map[string]bool

func NewSet

func NewSet() Set

type SetLog

type SetLog struct {
	Type    Type
	Records []Record
	Comment string
}

func New

func New(log_type Type) SetLog

func ReadCSV

func ReadCSV(r io.Reader, logs_type Type) SetLog

func ReadJSON

func ReadJSON(r io.Reader) SetLog

func (*SetLog) AppendRecords

func (l *SetLog) AppendRecords(records ...Record)

func (SetLog) CSV

func (l SetLog) CSV(w io.Writer) error

func (SetLog) Check

func (l SetLog) Check() bool

func (SetLog) Filter

func (l SetLog) Filter(exist func(r Record) bool) []Record

func (SetLog) FilterByID

func (l SetLog) FilterByID(id_set Set) []Record

func (SetLog) Keys

func (l SetLog) Keys() []string

func (*SetLog) Merge

func (l *SetLog) Merge(log SetLog)

Merge log typed mutate to l typed base.

func (SetLog) Rows

func (l SetLog) Rows() [][]string

func (SetLog) Set

func (l SetLog) Set(key string) Set

func (SetLog) TableFprintln

func (l SetLog) TableFprintln(w io.Writer)

func (*SetLog) Update

func (l *SetLog) Update(update func(r Record) Record)

type Type

type Type string
const TypeBase Type = "base"
const TypeEmpty Type = ""
const TypeMutate Type = "mutate"
const TypeSet Type = "set"

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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