collection

package
v0.0.0-...-9a67518 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(url string, fromFile bool) (doc *xml.XmlDocument, err error)

Types

type Collection

type Collection struct {
	Url string
	// contains filtered or unexported fields
}

A Collection describes and contains a list of Elements.

func LoadCollection

func LoadCollection(descCol DescCollection, args []string) (Collection, error)

func (*Collection) Close

func (col *Collection) Close()

func (*Collection) Init

func (col *Collection) Init()

func (Collection) Long

func (col Collection) Long(maxColWidth uint)

func (*Collection) Search

func (col *Collection) Search(searchPredicate func(string, string) string, key string, pattern string) Elements

func (*Collection) SearchFuzzy

func (col *Collection) SearchFuzzy(pattern string) Elements

func (*Collection) SearchFuzzyUnique

func (col *Collection) SearchFuzzyUnique(pattern string) (Element, error)

func (*Collection) SearchStrict

func (col *Collection) SearchStrict(pattern string) Elements

func (*Collection) SearchStrictUnique

func (col *Collection) SearchStrictUnique(pattern string) (Element, error)

func (*Collection) SearchStrictUniqueByKey

func (col *Collection) SearchStrictUniqueByKey(key string, pattern string) (Element, error)

func (*Collection) SearchXpathFuzzy

func (col *Collection) SearchXpathFuzzy(key string, pattern string) string

If key == "", the PrimaryField is used

func (*Collection) SearchXpathStrict

func (col *Collection) SearchXpathStrict(key string, pattern string) string

If key == "", the PrimaryField is used

func (Collection) Short

func (col Collection) Short()

func (Collection) Xml

func (c Collection) Xml()

type DescCollection

type DescCollection struct {
	// Names of arguments required from the user to get datas from
	// introspect
	PageArgs []string
	// A function that takes the list of arguments specified by
	// the user
	PageBuilder (func([]string) Sourcer)
	// The root Xpath
	BaseXpath string
	// Description of Collection's Elements
	DescElt DescElement
	// Name of the attribute used to search in the collection
	PrimaryField string
}

This contains informations to generate and query a Collection

type DescElement

type DescElement struct {
	// Xpath used to generate the short version of an element
	ShortDetailXpath string
	// Used to generate the long version of an element
	LongDetail LongFormatter
}

type Element

type Element struct {
	Node xml.Node
	// contains filtered or unexported fields
}

func (Element) GetField

func (e Element) GetField(field string) (string, error)

func (Element) Long

func (e Element) Long(maxColWidth uint)

func (Element) Short

func (e Element) Short()

func (Element) Xml

func (e Element) Xml()

type Elements

type Elements []Element

func (Elements) Long

func (elts Elements) Long(maxColWidth uint)

func (Elements) Short

func (elts Elements) Short()

func (Elements) Xml

func (elts Elements) Xml()

type File

type File struct {
	Path string
}

func (File) Load

func (file File) Load(descCol DescCollection) (Collection, error)

type Format

type Format uint8
const (
	FORMAT_TEXT         Format = 1
	FORMAT_TABLE_HEADER Format = 2
	FORMAT_TABLE        Format = 3
)

type LongFormatFn

type LongFormatFn (func(*uitable.Table, Element))

func (LongFormatFn) LongFormat

func (fn LongFormatFn) LongFormat(table *uitable.Table, format Format, e Element)

type LongFormatXpaths

type LongFormatXpaths []string

func (LongFormatXpaths) LongFormat

func (xpaths LongFormatXpaths) LongFormat(table *uitable.Table, format Format, e Element)

type LongFormatter

type LongFormatter interface {
	LongFormat(t *uitable.Table, f Format, e Element)
}

This is used to show the long version of an Element.

type Remote

type Remote struct {
	VrouterUrl string
	Port       int
	Table      string
}

func (Remote) Load

func (page Remote) Load(descCol DescCollection) (Collection, error)

type Shower

type Shower interface {
	Long(maxColWidth uint)
	Short()
	Xml()
}

Several representations of resources

type Sourcer

type Sourcer interface {
	Load(descCol DescCollection) (Collection, error)
}

type Webui

type Webui struct {
	VrouterUrl string
	Port       int
	Path       string
}

func (Webui) Load

func (page Webui) Load(descCol DescCollection) (Collection, error)

Jump to

Keyboard shortcuts

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