meta

package
v0.0.0-...-2c24670 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DELETE method = "DELETE"
	GET    method = "GET"
	POST   method = "POST"
	PATCH  method = "PATCH"
	PUT    method = "PUT"

	InputText   inputType = "text"
	InputPass   inputType = "password"
	InputBool   inputType = "bool"
	InputNumber inputType = "number"
	InputSelect inputType = "select"

	IdString idType = "string"
	IdInt    idType = "int"
)

Variables

This section is empty.

Functions

func APIURL

func APIURL(path string) string

APIURL full api url for the path

func JSONApiRefLink(i interface{}, rel string) *jsonapi.Links

JSONApiRefLink ref link helper

func JSONApiSelfLink(i interface{}) *jsonapi.Links

JSONApiSelfLink self link helper

Types

type ActionHolder

type ActionHolder []*JsonAPIAction

func (*ActionHolder) AddAction

func (ah *ActionHolder) AddAction(m method, name, urlHelper string, params ...interface{}) *JsonAPIAction

AddAction ...

func (*ActionHolder) RenderActions

func (ah *ActionHolder) RenderActions() *jsonapi.Meta

RenderActions ...

type Extendable

type Extendable interface {
	Extend() error
}

type FieldOption

type FieldOption struct {
	Label string                 `json:"label,omitempty"`
	Value interface{}            `json:"value"`
	Meta  map[string]interface{} `json:"meta,omitempty"`
}

func FieldOptionsFromValues

func FieldOptionsFromValues(values ...string) []FieldOption

type JsonAPIAction

type JsonAPIAction struct {
	Method       string         `json:"method"`
	Name         string         `json:"name"`
	URL          string         `json:"url"`
	Multi        bool           `json:"multi"`
	Relationship bool           `json:"relationship"`
	Fields       []JsonAPIField `json:"fields"`
}

func (*JsonAPIAction) Field

func (a *JsonAPIAction) Field(name string, inputType inputType, value interface{}, requred bool) *JsonAPIAction

Field ...

func (*JsonAPIAction) FieldWithOpts

func (a *JsonAPIAction) FieldWithOpts(name string, inputType inputType, value interface{}, requred bool, options []FieldOption) *JsonAPIAction

FieldWithOpts add field with options to action

func (*JsonAPIAction) Pagination

func (a *JsonAPIAction) Pagination(data *Pagination) *JsonAPIAction

Pagination add pagination meta to action

func (*JsonAPIAction) RelFields

func (a *JsonAPIAction) RelFields(typeName string) *JsonAPIAction

RelFields ...

type JsonAPIField

type JsonAPIField struct {
	Name      string        `json:"name"`
	InputType string        `json:"type"`
	Value     interface{}   `json:"value,omitempty"`
	Required  bool          `json:"required"`
	Options   []FieldOption `json:"options,omitempty"`
	Data      *Pagination   `json:"data,omitempty"`
}

type Pagination

type Pagination struct {
	Count int `json:"item_count"`
	Max   int `json:"max"`
	Page  int `json:"page"`
}

Jump to

Keyboard shortcuts

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