fields

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields struct {
	// contains filtered or unexported fields
}

Table fields

func New

func New(fields []*field.Field) Fields

Create new Fields struct Exits with error code if fields don't respect the following requirements: - fields must be unique within a table - names must be less than 20 characters - names must contain only uppercase letters and hyphens - names must not start or end with a hyphen

func NewNested

func NewNested(fields []*field.Field, parentObjectName string) Fields

Same as New, create new Fields struct but fields are in a nested object

func (Fields) AllFields

func (f Fields) AllFields() []*field.Field

Get all fields

func (Fields) AllNames

func (f Fields) AllNames() []string

Get the list of all field names

func (Fields) AreNested

func (f Fields) AreNested() (parentObjectName string, areNested bool)

Returns whether the fields belong to a nested structure and the parent object's name

func (Fields) GetJsonPropertyNameFromName

func (f Fields) GetJsonPropertyNameFromName(name string) (jsonPropertyName string, found bool)

Get JSON property name of field with the given name Returns the property name and a boolean to indicate whether the field was found

func (Fields) SetFieldJsonPropertyName

func (f Fields) SetFieldJsonPropertyName(name string, jsonPropertyName string) error

Modify the JSON property name of the field with the given name If no field is found with the given name, returns an error

func (Fields) SetVisible

func (f Fields) SetVisible(fieldNames []string) error

Override the default visibility settings and display only the given fields

func (Fields) ShowAll

func (f Fields) ShowAll()

Set all fields to visible

func (Fields) VisibleFields

func (f Fields) VisibleFields() []*field.Field

Get visible fields

func (Fields) VisibleFieldsJsonPropertyNames

func (f Fields) VisibleFieldsJsonPropertyNames() []string

Get the list of JSON property names of the visible fields

func (Fields) VisibleNames

func (f Fields) VisibleNames() []string

Get the list of names of the visible fields

func (Fields) VisibleSize

func (f Fields) VisibleSize() int

Get number of visible fields

Jump to

Keyboard shortcuts

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