代码拉取完成,页面将自动刷新
package xlsx
import (
"time"
"gitee.com/lite89/xlsx/internal"
)
// Record represents a record.
type Record struct {
dict map[string]int
cells []*internal.Cell
}
// String gets the record value as string.
func (a *Record) String(key string) string {
return a.cell(key).String()
}
// Bool gets the record value as bool.
func (a *Record) Bool(key string) bool {
return a.cell(key).Bool()
}
// Float gets the record value as float64.
func (a *Record) Float(key string) float64 {
return a.cell(key).Float()
}
// Int gets the record value as int.
func (a *Record) Int(key string) int {
return a.cell(key).Int()
}
// Time gets the record value as time.
func (a *Record) Time(key string) time.Time {
return a.cell(key).Time()
}
func (a *Record) cell(key string) *Cell {
if idx, ok := a.dict[key]; ok && idx < len(a.cells) {
return &Cell{a.cells[idx]}
}
return new(Cell)
}
// Records represents a records.
type Records struct {
dict map[string]int
rows []*internal.Row
index int
}
// Begin begins a iteration and returns the first record.
func (a *Records) Begin() *Record {
if a == nil {
return nil
}
a.index = 0
return a.Next()
}
// Next returns the next record.
func (a *Records) Next() *Record {
if a == nil {
return nil
}
if a.index < len(a.rows) {
record := &Record{dict: a.dict}
if row := a.rows[a.index]; row != nil {
record.cells = row.Cells
}
a.index++
return record
}
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。