Documentation ¶
Index ¶
- Constants
- Variables
- func MinimumDateTime() time.Time
- type Dbc
- type Dbf
- func (dbf *Dbf) CalculatedRecordCount() int
- func (dbf *Dbf) Close() error
- func (dbf *Dbf) DBC() string
- func (dbf *Dbf) FieldByName(name string) (Field, error)
- func (dbf *Dbf) Header() Header
- func (dbf *Dbf) ReadDBC() error
- func (dbf *Dbf) ReadFromDBC(db *Dbc) error
- func (dbf *Dbf) RecordAt(recno uint32, handle func(*Record), options ParseOption) error
- func (dbf *Dbf) Scan(walk func(*Record) error, options ParseOption) error
- func (dbf *Dbf) ScanOffset(offset uint32, walk func(*Record) error, options ParseOption) error
- type Field
- type FieldFlag
- type Flag
- type Header
- type ParseOption
- type Record
- func (r *Record) Deleted() bool
- func (r *Record) Field(fieldName string) (interface{}, error)
- func (r *Record) FieldAt(fieldIndex int) (interface{}, error)
- func (r *Record) Recno() uint32
- func (r *Record) ToMap() (map[string]interface{}, error)
- func (r *Record) ToSlice() ([]interface{}, error)
- func (r *Record) WithSlice(sf func([]interface{})) error
- type Type
Constants ¶
const ( FieldFlagNone = 0x00 FieldFlagSystem = 0x01 FieldFlagNull = 0x02 FieldFlagBinary = 0x04 FieldFlagBinaryAndNull = 0x06 FieldFlagAutoInc = 0x0C )
Variables ¶
var ErrInvalidRecordNumber = errors.New("Invalid record")
ErrInvalidRecordNumber is returned whenever a provided record number is invalid
Functions ¶
func MinimumDateTime ¶
MinimumDateTime returns 0001-01-01T00:00:00 @ time.Local
Types ¶
type Dbc ¶
type Dbc struct {
// contains filtered or unexported fields
}
Dbc is a database for Visual FoxPro tables
type Dbf ¶
type Dbf struct {
// contains filtered or unexported fields
}
Dbf provides methods to access a DBF
func (*Dbf) CalculatedRecordCount ¶
CalculatedRecordCount returns the calculated RecordCount or -1.
func (*Dbf) FieldByName ¶
FieldByName returns a field by it name (Case insensitive)
func (*Dbf) ReadDBC ¶
ReadDBC reads the DBC to which this table belongs. This updates the internal Fieldnames if they were longer than 10 chars
func (*Dbf) ReadFromDBC ¶
ReadFromDBC reads the DBC. This updates the internal Fieldnames if they were longer than 10 chars
func (*Dbf) RecordAt ¶
func (dbf *Dbf) RecordAt(recno uint32, handle func(*Record), options ParseOption) error
RecordAt reads the record at the specified position
func (*Dbf) Scan ¶
func (dbf *Dbf) Scan(walk func(*Record) error, options ParseOption) error
Scan walks the entire table until the end or walk returns a non nil error
func (*Dbf) ScanOffset ¶
ScanOffset walks the table starting at `offset` until the end or walk returns a non nil error
type Field ¶
type Field struct { Name string Type rune Displacement uint32 Length byte DecimalCount byte Flags FieldFlag NextAutoIncrement uint32 AutoIncrementStep byte Index int VarLengthSizeIndex int NullFieldIndex int }
Field provides methods to access a DBF
type Header ¶
type Header struct { Type Type ModYear byte ModMonth byte ModDay byte RecordCount uint32 HeaderSize uint16 RecordLength uint16 Reserved [16]byte Flags Flag CodePage byte }
Header defines the DBF header
func (Header) LastModified ¶
LastModified returns the last modification date
type ParseOption ¶
type ParseOption byte
ParseOption options for handling row parsing
const ( // ParseDefault default options ParseDefault ParseOption = 0 // ParseTrimRight strings.TrimRight(s, " ") is applied to `C`-type fields ParseTrimRight ParseOption = 1 << 0 )
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
Record provides methods to work with record
type Type ¶
type Type byte
Type specifies the table type
const ( // TypeNone ... TypeNone Type = 0x00 // TypeFoxBase ... TypeFoxBase Type = 0x02 // TypeFoxBasePlusDBaseIII ... TypeFoxBasePlusDBaseIII Type = 0x03 // TypeVisualFoxPro ... TypeVisualFoxPro Type = 0x30 // TypeVisualFoxProAutoInc ... TypeVisualFoxProAutoInc Type = 0x31 // TypeVisualFoxProVar ... TypeVisualFoxProVar Type = 0x32 // TypeDBaseIVTable ... TypeDBaseIVTable Type = 0x43 // TypeDBaseIVSystem ... TypeDBaseIVSystem Type = 0x63 // TypeFoxBasePlusDBaseIIIMemo ... TypeFoxBasePlusDBaseIIIMemo Type = 0x83 // TypeDBaseIVMemo ... TypeDBaseIVMemo Type = 0x8B // TypeDBaseIVTableMemo ... TypeDBaseIVTableMemo Type = 0xCB // TypeFoxPro2Memo ... TypeFoxPro2Memo Type = 0xF5 // TypeFoxBase2 ... TypeFoxBase2 Type = 0xFB )