1
0
Fork 0
piken/format/formatter.go

36 lines
745 B
Go
Raw Normal View History

// Copyright © 2015 Daniele Tricoli <eriol@mornie.org>.
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
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
}