selector

package
v0.0.0-...-ae86d3b Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StringValueType is the string value type.
	StringValueType = "string"
	// NumberValueType is the number value type.
	NumberValueType = "number"
)

Variables

View Source
var (
	// ErrInvalidValueType is returned when the value type is not string or number.
	ErrInvalidValueType = errors.New("invalid value type")
)

Functions

This section is empty.

Types

type SelectOption

type SelectOption struct {
	Name string `json:"name"`
	// The id could be number or string, so we use interface{} here.
	ID interface{} `json:"id"`
}

SelectOption represents a select option

func (*SelectOption) Get

func (s *SelectOption) Get() (string, *Selected)

Get returns the name of the option as string and the is as Selected

type SelectOptions

type SelectOptions []SelectOption

SelectOptions is a slice of SelectOption

type Selected

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

Selected is a struct to store the selected value.

func NewSelected

func NewSelected(value interface{}) (*Selected, error)

NewSelected creates a new Selected.

func (*Selected) DisplayValue

func (s *Selected) DisplayValue() string

DisplayValue returns the display value.

func (*Selected) Get

func (s *Selected) Get() interface{}

Get returns the value

func (*Selected) IsEmpty

func (s *Selected) IsEmpty() bool

IsEmpty returns true if the value is empty.

func (*Selected) IsSelected

func (s *Selected) IsSelected(value interface{}) bool

IsSelected returns true if the value is selected.

Jump to

Keyboard shortcuts

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