-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
43 lines (36 loc) · 1.17 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package vegagoja
// Param is a bound input parameter.
type Param struct {
Name string `json:"name,omitempty" mapstructure:"name"`
Bind Bind `json:"bind,omitempty" mapstructure:"bind"`
Value interface{} `json:"value,omitempty" mapstructure:"value"`
}
// Valid returns true when v conforms to the parameter's bind specification.
func (p Param) Valid(v interface{}) bool {
return p.Bind.Valid(v)
}
// Bind is the bound input parameter type definition.
type Bind struct {
Input BindType `json:"input,omitempty" mapstructure:"input"`
Min int `json:"min,omitempty" mapstructure:"min"`
Max int `json:"max,omitempty" mapstructure:"max"`
Step int `json:"step,omitempty" mapstructure:"step"`
}
// Valid returns true when v conforms to the specification.
func (bind Bind) Valid(v interface{}) bool {
return false
}
// BindType are input types.
//
// See: https://vega.github.io/vega/docs/signals/#bind
type BindType string
// Bind types.
const (
BindCheckbox BindType = "checkbox"
BindRadio BindType = "radio"
BindSelect BindType = "select"
)
// String satisfies the [fmt.Stringe] interface.
func (typ BindType) String() string {
return string(typ)
}