dbase5

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	CharacterDecoder() *encoding.Decoder
	FilteredFields() []string
}

Config provides config for record parsing.

type Field

type Field interface {
	Name() string
	Value() interface{}
	Equal(string) bool
}

Field provides common information about all field types.

type FieldDesc

type FieldDesc struct {
	Type FieldType
	// contains filtered or unexported fields
}

FieldDesc represents a field descriptor consisting of a type, name and size in bytes.

func DecodeFieldDesc

func DecodeFieldDesc(buf []byte) (*FieldDesc, error)

DecodeFieldDesc parses a single field descriptor.

func (FieldDesc) Name

func (f FieldDesc) Name() string

Name of the field.

type FieldType

type FieldType uint8

FieldType is the type of a field.

const (
	CharacterType     FieldType = 'C'
	DateType          FieldType = 'D'
	FloatingPointType FieldType = 'F'
	LogicalType       FieldType = 'L'
	MemoType          FieldType = 'M'
	NumericType       FieldType = 'N'
)

Field types for dBase Level 5.

type Header struct {
	Fields []*FieldDesc
	// contains filtered or unexported fields
}

Header represents a dBase 5 file header.

func DecodeHeader

func DecodeHeader(r io.Reader) (*Header, error)

DecodeHeader parses a dBase 5 file header.

func (Header) NumRecords

func (h Header) NumRecords() uint32

NumRecords returns the number of records in the file.

func (Header) RecordLen

func (h Header) RecordLen() uint16

RecordLen returns the size in bytes of each record in the file.

type Record

type Record struct {
	Fields map[string]Field
	// contains filtered or unexported fields
}

Record represents a single record, primarly consisting of a set of fields.

func DecodeRecord

func DecodeRecord(buf []byte, header *Header, conf Config) (*Record, error)

DecodeRecord decodes a dBase 5 single record.

func (Record) Deleted

func (r Record) Deleted() bool

Deleted returns the value of the deleted flag.

Jump to

Keyboard shortcuts

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