adt

package module
v0.0.0-...-64b47c6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: MIT Imports: 12 Imported by: 0

README

adt

GoDoc

Documentation

Overview

Package adt provides read access to ADT database files

Index

Constants

View Source
const (
	HeaderLength           = 400
	ColumnDescriptorLength = 200
	MagicHeader            = "Advantage Table"
)
View Source
const RecordMagicHeader = "\x04\x00\x00\x00"

Variables

View Source
var (
	ErrMagicHeaderNotFound = errors.New("adt: magic header missing")
	ErrMultiplePKs         = errors.New("adt: multiple primary keys")
)
View Source
var ErrReadingColumnDescriptor = errors.New("adt: error reading column descriptor")

Functions

func ReadValue

func ReadValue(src []byte, column *Column) (interface{}, error)

Types

type Column

type Column struct {
	Name          string
	Type          ColumnType
	Length        uint16
	Offset        uint16
	DecimalDigits uint16
}

func ColumnFromReader

func ColumnFromReader(r io.Reader) (*Column, error)

func (Column) String

func (c Column) String() string

type ColumnType

type ColumnType uint8
const (
	ColumnTypeBool          ColumnType = 1
	ColumnTypeCharacter     ColumnType = 4
	ColumnTypeMemo          ColumnType = 5
	ColumnTypeBlob          ColumnType = 6
	ColumnTypeDouble        ColumnType = 10
	ColumnTypeInt           ColumnType = 11
	ColumnTypeShortInt      ColumnType = 12
	ColumnTypeCiCharacter   ColumnType = 20
	ColumnTypeAutoIncrement ColumnType = 15
	ColumnTypeDate          ColumnType = 3
	ColumnTypeTime          ColumnType = 13
	ColumnTypeTimestamp     ColumnType = 14
	ColumnTypeCurrency      ColumnType = 17
)

func (ColumnType) SQLType

func (ct ColumnType) SQLType() string

func (ColumnType) String

func (i ColumnType) String() string

type MemoField

type MemoField struct {
	BlockOffset uint32
	Length      uint16
}

type Record

type Record map[string]interface{}

type Table

type Table struct {
	Name         string
	RecordCount  uint32
	DataOffset   uint16
	RecordLength uint32
	Columns      []*Column
	// contains filtered or unexported fields
}

func FromReaders

func FromReaders(adtContent io.ReadSeeker, admContent io.ReadSeeker) (*Table, error)

func TableFromPath

func TableFromPath(filePath string) (*Table, error)

func (*Table) Get

func (t *Table) Get(record int) (Record, error)

func (*Table) GetPK

func (t *Table) GetPK() (*Column, error)

func (*Table) InsertSQL

func (t *Table) InsertSQL(tableName string) string

func (*Table) SQLDDL

func (t *Table) SQLDDL(tableName string) (string, error)

Directories

Path Synopsis
cmd
adt2csv
Command
Command
adt2http
Command Command
Command Command
adt2json
Command
Command
adt2sql
Command
Command
adtdump
Command adtdump dumps information about an ADT database
Command adtdump dumps information about an ADT database

Jump to

Keyboard shortcuts

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