dbf

package module
v0.0.0-...-91c8246 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

go-dbf

dbase file reader for Go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BadHeaderLength error = errors.New("Bad dbf header length")

Functions

This section is empty.

Types

type Dbf

type Dbf struct {
	Version        byte
	Year           int
	Month          int
	Day            int
	NumRecords     uint32
	NumHeaderBytes uint16
	NumRecordBytes uint16
	Incomplete     byte
	Encrypted      byte
	Mdx            byte
	Language       byte
	DriverName     string
	Fields         []DbfField
	// contains filtered or unexported fields
}

DBase database file format, just enough to read Census shapefile bundles. http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm https://www.clicketyclick.dk/databases/xbase/format/dbf.html

func NewDbf

func NewDbf(reader io.ReadCloser) (d *Dbf, err error)

NewDbf reads the header immediately and may return (nil, error)

func (*Dbf) Close

func (d *Dbf) Close() error

func (*Dbf) Next

func (d *Dbf) Next() error

Next returns nil error when ok, io.EOF as apporpriate, or other underlying errors.

type DbfField

type DbfField struct {
	Name   string
	Type   DbfFieldType
	Length uint8
	Count  uint8

	// StartPos is the calulated (not read from file) position within fixed size record row
	StartPos int
	// contains filtered or unexported fields
}

func (*DbfField) GoString

func (h *DbfField) GoString() string

GoString is the debug string describing the field header information

func (*DbfField) Int64

func (h *DbfField) Int64() (i int64, err error)

func (*DbfField) Parse

func (h *DbfField) Parse(data []byte) error

Parse loads the next chunk of DBF header into this field record

func (*DbfField) String

func (h *DbfField) String() string

func (*DbfField) StringValue

func (h *DbfField) StringValue() string

StringValue is the value of this field for the current row.

type DbfFieldType

type DbfFieldType uint8
const (
	DbfFieldNumeric DbfFieldType = DbfFieldType('N')
	DbfFieldChar    DbfFieldType = DbfFieldType('C')
)

Directories

Path Synopsis
cmd
censustest command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL