mirror of
https://github.com/pbnjay/grate.git
synced 2024-12-04 19:45:34 +02:00
provide access to format strings
This commit is contained in:
parent
a40620db11
commit
ebe430dc09
@ -131,6 +131,19 @@ func (s *Sheet) Types() []string {
|
||||
return res
|
||||
}
|
||||
|
||||
// Formats extracts the format code for the current record into a list.
|
||||
func (s *Sheet) Formats() []string {
|
||||
ok := true
|
||||
res := make([]string, s.NumCols)
|
||||
for i, cell := range s.Rows[s.CurRow-1] {
|
||||
res[i], ok = builtInFormats[cell.FormatNo()]
|
||||
if !ok {
|
||||
res[i] = fmt.Sprint(cell.FormatNo())
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// Scan extracts values from the current record into the provided arguments
|
||||
// Arguments must be pointers to one of 5 supported types:
|
||||
// bool, int64, float64, string, or time.Time
|
||||
|
3
grate.go
3
grate.go
@ -34,6 +34,9 @@ type Collection interface {
|
||||
// and special cases: "blank", "hyperlink" which are string types
|
||||
Types() []string
|
||||
|
||||
// Formats extracts the format codes for the current record into a list.
|
||||
Formats() []string
|
||||
|
||||
// Scan extracts values from the current record into the provided arguments
|
||||
// Arguments must be pointers to one of 5 supported types:
|
||||
// bool, int64, float64, string, or time.Time
|
||||
|
@ -44,6 +44,15 @@ func (t *simpleFile) Strings() []string {
|
||||
return t.rows[t.iterRow]
|
||||
}
|
||||
|
||||
// Formats extracts the format code for the current record into a list.
|
||||
func (t *simpleFile) Formats() []string {
|
||||
res := make([]string, len(t.rows[t.iterRow]))
|
||||
for i := range res {
|
||||
res[i] = "General"
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// Types extracts the data types from the current record into a list.
|
||||
// options: "boolean", "integer", "float", "string", "date",
|
||||
// and special cases: "blank", "hyperlink" which are string types
|
||||
|
Loading…
Reference in New Issue
Block a user