dataview

package
v2.12.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataView

type DataView struct {
	Paths       []string
	Extension   string
	Pattern     string
	Definitions []Definition
	Logger      *logger.Logger
	ActiveView  *Definition
	// contains filtered or unexported fields
}

DataView data view containing pre-definied views

func NewDataView

func NewDataView(pattern string, extension string, log *logger.Logger, paths ...string) (*DataView, error)

NewDataView creates a new data view which selected a view based in json data

func (*DataView) ClearActiveView

func (v *DataView) ClearActiveView()

ClearActiveView clear the active view

func (*DataView) GetActiveView

func (v *DataView) GetActiveView() *Definition

GetActiveView get the active view

func (*DataView) GetDefinitions

func (v *DataView) GetDefinitions() []Definition

func (*DataView) GetView

func (v *DataView) GetView(data *gjson.Result, contentType ...string) ([]string, error)

func (*DataView) GetViewByName

func (v *DataView) GetViewByName(pattern string) ([]string, error)

GetViewByName get view by name. Accepts wildcard name

func (*DataView) GetViews

func (v *DataView) GetViews(pattern string) ([]Definition, error)

GetViews get a list of view names

func (*DataView) LoadDefinitions

func (v *DataView) LoadDefinitions() error

LoadDefinitions load the view definitions

type Definition

type Definition struct {
	FileName    string   `json:"-"`
	Name        string   `json:"name,omitempty"`
	Priority    int      `json:"priority,omitempty"`
	Fragments   []string `json:"fragments,omitempty"`
	Type        string   `json:"type,omitempty"`
	ContentType string   `json:"contentType,omitempty"`
	Self        string   `json:"self,omitempty"`
	Columns     []string `json:"columns,omitempty"`
}

Definition contains the view definition of when to use a specific view

type DefinitionCollection

type DefinitionCollection struct {
	Definitions []Definition `json:"definitions,omitempty"`
}

DefinitionCollection collection of view definitions

Jump to

Keyboard shortcuts

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