dataview

package
v2.22.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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