dataview

package
v2.46.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NamespaceSeparator = "::"

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(r *ViewData) ([]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:"-"`
	Path          string   `json:"-"`
	Extension     string   `json:"-"`
	Name          string   `json:"name,omitempty"`
	Priority      int      `json:"priority,omitempty"`
	Fragments     []string `json:"fragments,omitempty"`
	Type          string   `json:"type,omitempty"`
	RequestPath   string   `json:"requestPath,omitempty"`
	RequestMethod string   `json:"requestMethod,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

func (*Definition) FQDN added in v2.30.0

func (d *Definition) FQDN() string

type DefinitionCollection

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

DefinitionCollection collection of view definitions

type ViewData added in v2.30.0

type ViewData struct {
	ResponseBody *gjson.Result
	ContentType  string
	Response     *http.Response
	Request      *http.Request
}

Jump to

Keyboard shortcuts

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