-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfield.go
59 lines (48 loc) · 782 Bytes
/
field.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package fork
import (
"net/http"
"strings"
)
type Field interface {
Named
New(...interface{}) Field
Get() *Value
Set(*http.Request)
Processor
}
type Named interface {
Name() string
ReName(...string) string
}
func newnamed(name string) *named {
return &named{name: name}
}
type named struct {
name string
}
func (n *named) Name() string {
return n.name
}
func (n *named) ReName(rename ...string) string {
if len(rename) > 0 {
n.name = strings.Join(rename, "-")
}
return n.name
}
func (n *named) Copy() *named {
var ret named = *n
return &ret
}
type Processor interface {
Widget
Filterer
Validater
}
type processor struct {
Widget
Validater
Filterer
}
func NewProcessor(w Widget, v Validater, f Filterer) *processor {
return &processor{w, v, f}
}