1
0
Fork 0
piken/format/formatter.go

31 lines
559 B
Go
Raw Normal View History

2015-11-12 02:08:37 +01:00
package format // import "eriol.xyz/piken/format"
import "eriol.xyz/piken/sql"
type Formatter interface {
Format(*sql.UnicodeData) (string, error)
}
type baseFormatter struct {
fields []string
showGlyph bool
}
2015-12-08 04:00:31 +01:00
func (bf *baseFormatter) SetFields(fields []string) {
2015-11-12 02:08:37 +01:00
for _, field := range fields {
2015-12-08 04:00:31 +01:00
bf.fields = append(bf.fields, field)
2015-11-12 02:08:37 +01:00
}
}
2015-12-08 04:00:31 +01:00
func (bf baseFormatter) Fields() []string {
return bf.fields
2015-11-12 02:08:37 +01:00
}
2015-12-08 04:00:31 +01:00
func (bf *baseFormatter) SetShowGlyph(value bool) {
bf.showGlyph = value
2015-11-12 02:08:37 +01:00
}
2015-12-08 04:00:31 +01:00
func (bf baseFormatter) ShowGlyph() bool {
return bf.showGlyph
2015-11-12 02:08:37 +01:00
}