adatypes

package
v1.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package adatypes is used to define types use for parsing Adabas field definitions tables. It contains Adabas and Natural DDM like Map definitions. It converts Adabas types to GO types and vice versa. In addition it contains basic functions used to handle logging facilities and Adabas buffer parsing and generation.

Index

Examples

Constants

View Source
const (
	// EQ Equals value comparisons
	EQ comparator = iota
	// LT Less than comparisons
	LT
	// LE Less equal comparisons
	LE
	// GT Greater than comparisons
	GT
	// GE Greater equal comparisons
	GE
	// NE Not equal comparison
	NE
	// NONE No comparison (Not needed)
	NONE
)
View Source
const (
	// EMPTY Empty (not needed)
	EMPTY logicBound = iota
	// AND AND logic
	AND
	// OR Adabas OR logic
	OR
	// MOR Adabas OR logic with same descriptor
	MOR
	// RANGE  Range for a value
	RANGE
	// NOT NOT logic
	NOT
)
View Source
const BufferOverflow = -1

BufferOverflow error indicates the read after the buffer maximal position

View Source
const ConstantIndicator = "#"

ConstantIndicator constant indicator is replaced with constants

View Source
const NoReferenceField = math.MaxInt32

NoReferenceField field out of range of given field possibilities

View Source
const OccByte = -12

OccByte Occurence identifier indicating that the occurence is defined as byte

View Source
const OccCapacity = -8

OccCapacity Occurence identifier indicating that the occurence capactity of MU or PE fields

View Source
const OccNone = -10

OccNone Occurence identifier indicating that the occurence is not used

View Source
const OccSingle = -9

OccSingle Occurence identifier indicating that the occurence single

View Source
const OccUInt2 = -11

OccUInt2 Occurence identifier indicating that the occurence is defined as uint32

View Source
const PartialLobSize = 4096

PartialLobSize partial lob read size of first read

View Source
const PlatformLUWHighOrder = 0x20

PlatformLUWHighOrder LUW high order architecture byte

View Source
const PlatformLUWLowOrder = 0x21

PlatformLUWLowOrder LUW low order architecture byte

View Source
const PlatformMainframe = 0x0

PlatformMainframe Mainframe architecture byte

Variables

View Source
var Central = centralOptions{Log: logrus.New(), /* contains filtered or unexported fields */}

Central central configuration

Functions

func FinitDefinitionCache

func FinitDefinitionCache()

FinitDefinitionCache finit definition cache

func FormatByteBuffer

func FormatByteBuffer(header string, b []byte) string

FormatByteBuffer formats the byte array to an output with a hexadecimal part, a ASCII part and a EBCDIC converted part of the same data

Example (Output)
f, err := initLogWithFile("formatter.log")
if err != nil {
	fmt.Println(err)
	return
}
defer f.Close()

s := []byte("ABCDEFGHABCDEFGHABCDEFGHABCDEFGH")
fmt.Println(FormatByteBuffer("ABC :", s))
Output:

ABC :: Dump len=32(0x20)
0000 4142 4344 4546 4748 4142 4344 4546 4748  ABCDEFGHABCDEFGH ................
0010 4142 4344 4546 4748 4142 4344 4546 4748  ABCDEFGHABCDEFGH ................

func FormatBytes

func FormatBytes(header string, b []byte, modSpace int, max int) string

FormatBytes formats a given byte array and modulo space operator. The modulo space defines the the possition a space is added to the output. The maximum give the maximum characters per line.

Example
f, err := initLogWithFile("formatter.log")
if err != nil {
	fmt.Println(err)
	return
}
defer f.Close()

b := [5]byte{23, 44, 12, 33, 45}
fmt.Println(FormatBytes("XXX : ", b[:], 4, -1))
s := []byte("ABCDEFGHIC")
fmt.Println(FormatBytes("ABC : ", s, 0, -1))
e := [5]byte{0x81, 0x82, 0xc3, 0xc4, 0x86}
fmt.Println(FormatBytes("EBCDIC : ", e[:], 5, -1))
Output:

XXX : 172C0C21 2D [.,.!-] [.....]

ABC : 41424344454647484943 [ABCDEFGHIC] [..........]

EBCDIC : 8182C3C486  [��ÃÄ�] [abCDf]
Example (OmitDoubles)
f, err := initLogWithFile("formatter.log")
if err != nil {
	fmt.Println(err)
	return
}
defer f.Close()

s := []byte("ABCDEFGHABCDEFGHABCDEFGHABCDEFGH")
fmt.Println(FormatBytes("ABC :", s, 4, 8))
Output:

ABC :
0000 41424344 45464748  [ABCDEFGH] [........]
0008 skipped equal lines
0018 41424344 45464748  [ABCDEFGH] [........]
Example (X)
f, err := initLogWithFile("formatter.log")
if err != nil {
	fmt.Println(err)
	return
}
defer f.Close()

s := []byte("ABCDEFGHIJKLMNOPQRSTUVWXYT")
fmt.Println(FormatBytes("ABC :", s, 4, 8))
Output:

ABC :
0000 41424344 45464748  [ABCDEFGH] [........]
0008 494A4B4C 4D4E4F50  [IJKLMNOP] [...<(+|&]
0010 51525354 55565758  [QRSTUVWX] [........]
0018 5954               [YT      ] [..      ]

func FormatBytesWithLength

func FormatBytesWithLength(header string, b []byte, modSpace int, max int, showLength bool) string

FormatBytesWithLength formats a given byte array and modulo space operator. The modulo space defines the the possition a space is added to the output. The maximum give the maximum characters per line. This function enhance the display with showing the length if showLength is set to true

func InitDefinitionCache

func InitDefinitionCache()

InitDefinitionCache init definition cache

func LogMultiLineString

func LogMultiLineString(logOutput string)

LogMultiLineString log multi line string to log. This prevent the \n display in log. Instead multiple lines are written to log

func TimeTrack

func TimeTrack(start time.Time, name string)

TimeTrack defer function measure the difference end log it to log management, like

defer TimeTrack(time.Now(), "CallAdabas "+string(adabas.Acbx.Acbxcmd[:]))

func Translate

func Translate(locale, message string, args ...interface{}) string

Translate translates content to target language.

Types

type AdaCollationType

type AdaCollationType struct {
	AdaType
	// contains filtered or unexported fields
}

AdaCollationType data type structure for field types, no structures

func NewCollationType

func NewCollationType(name string, length uint16, parentName string, collAttribute string) *AdaCollationType

NewCollationType creates new collation type instance

func (*AdaCollationType) String

func (fieldType *AdaCollationType) String() string

String string representation of the collation type

type AdaHyperExitType

type AdaHyperExitType struct {
	AdaType
	// contains filtered or unexported fields
}

AdaHyperExitType data type structure for field types, no structures

func NewHyperExitType

func NewHyperExitType(name string, length uint32, fdtFormat byte, nr uint8, parentNames []string) *AdaHyperExitType

NewHyperExitType new hyper exit type

func (*AdaHyperExitType) String

func (fieldType *AdaHyperExitType) String() string

String string representation of the hyper exit type

type AdaPhoneticType

type AdaPhoneticType struct {
	AdaType
	// contains filtered or unexported fields
}

AdaPhoneticType data type phonetic descriptor for field types, no structures

func NewPhoneticType

func NewPhoneticType(name string, descriptorLength uint16, parentName string) *AdaPhoneticType

NewPhoneticType new phonetic descriptor type

func (*AdaPhoneticType) String

func (fieldType *AdaPhoneticType) String() string

String string representation of the phonetic type

type AdaRange

type AdaRange struct {
	// contains filtered or unexported fields
}

AdaRange Adabas range definition

func NewEmptyRange

func NewEmptyRange() *AdaRange

NewEmptyRange create an empty range

func NewLastRange

func NewLastRange() *AdaRange

NewLastRange range defining only the last entry

func NewRange

func NewRange(from, to int) *AdaRange

NewRange new range from a dimension to a dimension

func NewRangeParser added in v1.1.1

func NewRangeParser(r string) *AdaRange

NewRangeParser new range using string parser

func NewSingleRange

func NewSingleRange(index int) *AdaRange

NewSingleRange new single dimensioned range

func (*AdaRange) FormatBuffer

func (adaRange *AdaRange) FormatBuffer() string

FormatBuffer generate corresponding format buffer

type AdaReferentialType

type AdaReferentialType struct {
	AdaType
	// contains filtered or unexported fields
}

AdaReferentialType data type structure for referential integrity types, no structures

func NewReferentialType

func NewReferentialType(name string, refFile uint32, keys [2]string, refType uint8, refUpdateAction uint8, refDeleteAction uint8) *AdaReferentialType

NewReferentialType new referential integrity type

func (*AdaReferentialType) String

func (fieldType *AdaReferentialType) String() string

String string representation of the hyper exit type

type AdaSuperType

type AdaSuperType struct {
	CommonType
	FdtFormat byte
	Entries   []subSuperEntries
}

AdaSuperType data type structure for super or sub descriptor field types, no structures

func NewSuperType

func NewSuperType(name string, option byte) *AdaSuperType

NewSuperType new super or sub descriptor field type

func (*AdaSuperType) AddSubEntry

func (adaType *AdaSuperType) AddSubEntry(name string, from uint16, to uint16)

AddSubEntry add sub field entry on super or sub descriptors

func (*AdaSuperType) IsStructure

func (adaType *AdaSuperType) IsStructure() bool

IsStructure return the structure of the field

func (*AdaSuperType) Length

func (adaType *AdaSuperType) Length() uint32

Length return the length of the field

func (*AdaSuperType) Option

func (adaType *AdaSuperType) Option() string

Option string representation of all option of Sub or super descriptors

func (*AdaSuperType) SetLength

func (adaType *AdaSuperType) SetLength(length uint32)

SetLength set the length of the field

func (*AdaSuperType) String

func (adaType *AdaSuperType) String() string

String string representation of the sub or super descriptor

func (*AdaSuperType) Value

func (adaType *AdaSuperType) Value() (adaValue IAdaValue, err error)

Value value of the sub or super descriptor

type AdaType

type AdaType struct {
	CommonType
	SysField  byte
	EditMask  byte
	SubOption byte
}

AdaType data type structure for field types, no structures

func NewLongNameType

func NewLongNameType(fType FieldType, name string, shortName string) *AdaType

NewLongNameType Define new type with length equal 1

func NewLongNameTypeWithLength

func NewLongNameTypeWithLength(fType FieldType, name string, shortName string, length uint32) *AdaType

NewLongNameTypeWithLength Definen new type

func NewType

func NewType(fType FieldType, name string) *AdaType

NewType Define new type with length equal 1

func NewTypeWithLength

func NewTypeWithLength(fType FieldType, name string, length uint32) *AdaType

NewTypeWithLength Definen new type

func (*AdaType) IsStructure

func (adaType *AdaType) IsStructure() bool

IsStructure return if it is an structure

func (*AdaType) Length

func (adaType *AdaType) Length() uint32

Length return the length of the field

func (*AdaType) Option

func (adaType *AdaType) Option() string

Option output all options of a field in an string

func (*AdaType) SetLength

func (adaType *AdaType) SetLength(length uint32)

SetLength set the length of the field

func (*AdaType) String

func (adaType *AdaType) String() string

String return the name of the field

func (*AdaType) Value

func (adaType *AdaType) Value() (adaValue IAdaValue, err error)

Value return type specific value structure object

type BufferHelper

type BufferHelper struct {
	// contains filtered or unexported fields
}

BufferHelper buffer helper structure used to parse the buffer

func NewDynamicHelper

func NewDynamicHelper(order binary.ByteOrder) *BufferHelper

NewDynamicHelper create a new buffer helper instance

func NewHelper

func NewHelper(buffer []byte, max int, order binary.ByteOrder) *BufferHelper

NewHelper create a new buffer helper instance

func (*BufferHelper) Buffer

func (helper *BufferHelper) Buffer() []byte

Buffer buffer array

func (*BufferHelper) Offset

func (helper *BufferHelper) Offset() uint32

Offset offset of used bytes in the buffer

func (*BufferHelper) PutInt16

func (helper *BufferHelper) PutInt16(data int16) (err error)

PutInt16 put 2-byte integer

func (*BufferHelper) PutInt32

func (helper *BufferHelper) PutInt32(data int32) (err error)

PutInt32 put 4-byte integer

func (*BufferHelper) PutInt64

func (helper *BufferHelper) PutInt64(data int64) (err error)

PutInt64 put 8-byte integer

func (*BufferHelper) PutUInt16

func (helper *BufferHelper) PutUInt16(data uint16) (err error)

PutUInt16 put 2-byte unsigned integer

func (*BufferHelper) PutUInt32

func (helper *BufferHelper) PutUInt32(data uint32) (err error)

PutUInt32 put 4-byte unsigned integer

func (*BufferHelper) PutUInt64

func (helper *BufferHelper) PutUInt64(data uint64) (err error)

PutUInt64 put 8-byte unsigned integer

func (*BufferHelper) PutUInt8

func (helper *BufferHelper) PutUInt8(data uint8) (err error)

PutUInt8 put 1-byte unsigned integer

func (*BufferHelper) ReceiveBytes

func (helper *BufferHelper) ReceiveBytes(length uint32) (res []byte, err error)

ReceiveBytes receive bytes length

func (*BufferHelper) ReceiveBytesOcc

func (helper *BufferHelper) ReceiveBytesOcc(occ int) (res []byte, err error)

ReceiveBytesOcc receive bytes using a specific occurence

func (*BufferHelper) ReceiveInt16

func (helper *BufferHelper) ReceiveInt16() (res int16, err error)

ReceiveInt16 receive 2-byte integer

func (*BufferHelper) ReceiveInt32

func (helper *BufferHelper) ReceiveInt32() (res int32, err error)

ReceiveInt32 reveive 4-byte integer

func (*BufferHelper) ReceiveInt64

func (helper *BufferHelper) ReceiveInt64() (res int64, err error)

ReceiveInt64 reveive 8-byte integer

func (*BufferHelper) ReceiveInt8

func (helper *BufferHelper) ReceiveInt8() (res int8, err error)

ReceiveInt8 receive 1-byte integer

func (*BufferHelper) ReceiveString

func (helper *BufferHelper) ReceiveString(length uint32) (res string, err error)

ReceiveString receive string of length

func (*BufferHelper) ReceiveUInt16

func (helper *BufferHelper) ReceiveUInt16() (res uint16, err error)

ReceiveUInt16 receive 2-byte unsigned integer

func (*BufferHelper) ReceiveUInt32

func (helper *BufferHelper) ReceiveUInt32() (res uint32, err error)

ReceiveUInt32 receive 4-byte unsigned integer

func (*BufferHelper) ReceiveUInt64

func (helper *BufferHelper) ReceiveUInt64() (res uint64, err error)

ReceiveUInt64 reveive 8-byte unsigned integer

func (*BufferHelper) ReceiveUInt8

func (helper *BufferHelper) ReceiveUInt8() (res uint8, err error)

ReceiveUInt8 receive 1-byte unsigned integer

func (*BufferHelper) Remaining

func (helper *BufferHelper) Remaining() int

Remaining remaining bytes in the buffer

func (*BufferHelper) Shrink

func (helper *BufferHelper) Shrink(length uint32) (err error)

Shrink shrink the buffer to the given length

type BufferOption

type BufferOption struct {
	MultifetchCall bool
	StoreCall      bool
	SecondCall     bool
	NeedSecondCall bool
	ExchangeRecord bool
	PartialLobSize bool
	Ascending      bool
	Mainframe      bool
	// contains filtered or unexported fields
}

BufferOption option for buffer parsing

func NewBufferOption

func NewBufferOption(store bool, secondCall bool) *BufferOption

NewBufferOption create option to parse the buffer

func NewBufferOption3 added in v1.1.1

func NewBufferOption3(store bool, secondCall bool, mainframe bool) *BufferOption

NewBufferOption3 create option to parse the buffer

type CommonType

type CommonType struct {
	// contains filtered or unexported fields
}

CommonType common data type structure defined for all types

func (*CommonType) AddFlag

func (commonType *CommonType) AddFlag(flagOption FlagOption)

AddFlag add the flag to the type flag set

func (*CommonType) AddOption

func (commonType *CommonType) AddOption(fieldOption FieldOption)

AddOption add the option to the field

func (*CommonType) ClearOption

func (commonType *CommonType) ClearOption(fieldOption FieldOption)

ClearOption clear the option to the field

func (*CommonType) Endian

func (commonType *CommonType) Endian() binary.ByteOrder

Endian Get data endian

func (*CommonType) GetParent

func (commonType *CommonType) GetParent() IAdaType

GetParent get the parent defined to this type

func (*CommonType) HasFlagSet

func (commonType *CommonType) HasFlagSet(flagOption FlagOption) bool

HasFlagSet check if given flag is set

func (*CommonType) IsOption

func (commonType *CommonType) IsOption(fieldOption FieldOption) bool

IsOption Check if the option of the field is set

func (*CommonType) IsSpecialDescriptor

func (commonType *CommonType) IsSpecialDescriptor() bool

IsSpecialDescriptor return true if it is a special descriptor

func (*CommonType) IsStructure

func (commonType *CommonType) IsStructure() bool

IsStructure return if the type is of structure types

func (*CommonType) Level

func (commonType *CommonType) Level() uint8

Level Type return level of the field

func (*CommonType) Name

func (commonType *CommonType) Name() string

Name return the name of the field

func (*CommonType) RemoveFlag

func (commonType *CommonType) RemoveFlag(flagOption FlagOption)

RemoveFlag add the flag to the type flag set

func (*CommonType) SetEndian

func (commonType *CommonType) SetEndian(endian binary.ByteOrder)

SetEndian Set data endian

func (*CommonType) SetLevel

func (commonType *CommonType) SetLevel(level uint8)

SetLevel Set Adabas level of the field

func (*CommonType) SetName

func (commonType *CommonType) SetName(name string)

SetName set the name of the field

func (*CommonType) SetOption

func (commonType *CommonType) SetOption(option uint32)

SetOption Set all options of the field

func (*CommonType) SetParent

func (commonType *CommonType) SetParent(parentType IAdaType)

SetParent set the parent of the type

func (*CommonType) SetRange added in v1.1.1

func (commonType *CommonType) SetRange(r *AdaRange)

SetRange set Adabas range

func (*CommonType) ShortName

func (commonType *CommonType) ShortName() string

ShortName return the short name of the field

func (*CommonType) Type

func (commonType *CommonType) Type() FieldType

Type returns field type of the field

type Definition

type Definition struct {
	Values []IAdaValue
	// contains filtered or unexported fields
}

Definition struct defines main entry point for parser structure

Example (AddValue)
f, err := initLogWithFile("definition.log")
if err != nil {
	return
}
defer f.Close()
testDefinition := createPeriodGroupMultiplerField()
testDefinition.DumpTypes(false, false)

err = testDefinition.SetValueWithIndex("UB", nil, 1)
if err != nil {
	fmt.Println("Add value to UB:", err)
	return
}
err = testDefinition.SetValueWithIndex("GC", []uint32{1}, "A")
if err != nil {
	fmt.Println("Add Value of GC:", err)
	return
}
testDefinition.DumpValues(false)
Output:

Dump all file field types:
  1, U4, 4, B  ; U4  PE=false MU=false REMOVE=true
  1, B1, 1, F  ; B1  PE=false MU=false REMOVE=true
  1, UB, 1, B  ; UB  PE=false MU=false REMOVE=true
  1, I2, 2, B  ; I2  PE=false MU=false REMOVE=true
  1, U8, 8, B  ; U8  PE=false MU=false REMOVE=true
  1, GR ,PE ; GR  PE=true MU=true REMOVE=true PE=1-N
    2, GC, 1, A  ; GC  PE=true MU=true REMOVE=true PE=1-N
    2, GM, 5, P ,MU; GM  PE=true MU=true REMOVE=true PE=1-N MU=1-N
      3, GM, 5, P  ; GM  PE=true MU=true REMOVE=true
    2, GS, 1, A  ; GS  PE=true MU=true REMOVE=true PE=1-N
    2, GP, 1, P  ; GP  PE=true MU=true REMOVE=true PE=1-N
  1, I8, 8, B  ; I8  PE=false MU=false REMOVE=true

Dump values :   U4 = >0<
 B1 = >0<
 UB = >1<
 I2 = >0<
 U8 = >0<
 GR = [1]
  GC[1] = >65<
  GM[1] = [0]
  GS[1] = > <
  GP[1] = >0<
 I8 = >0<
Example (DumpValues)
f, err := initLogWithFile("definition.log")
if err != nil {
	return
}
defer f.Close()
testDefinition := createPeriodGroupMultiplerField()
testDefinition.DumpTypes(false, false)
testDefinition.DumpValues(false)
Output:

Dump all file field types:
  1, U4, 4, B  ; U4  PE=false MU=false REMOVE=true
  1, B1, 1, F  ; B1  PE=false MU=false REMOVE=true
  1, UB, 1, B  ; UB  PE=false MU=false REMOVE=true
  1, I2, 2, B  ; I2  PE=false MU=false REMOVE=true
  1, U8, 8, B  ; U8  PE=false MU=false REMOVE=true
  1, GR ,PE ; GR  PE=true MU=true REMOVE=true PE=1-N
    2, GC, 1, A  ; GC  PE=true MU=true REMOVE=true PE=1-N
    2, GM, 5, P ,MU; GM  PE=true MU=true REMOVE=true PE=1-N MU=1-N
      3, GM, 5, P  ; GM  PE=true MU=true REMOVE=true
    2, GS, 1, A  ; GS  PE=true MU=true REMOVE=true PE=1-N
    2, GP, 1, P  ; GP  PE=true MU=true REMOVE=true PE=1-N
  1, I8, 8, B  ; I8  PE=false MU=false REMOVE=true

Dump values :   U4 = >0<
 B1 = >0<
 UB = >0<
 I2 = >0<
 U8 = >0<
 GR = [0]
 I8 = >0<
Example (DumpValuesAll)
f, err := initLogWithFile("definition.log")
if err != nil {
	fmt.Println("Error init log ", err)
	return
}
defer f.Close()

testDefinition := createLayout()

testDefinition.DumpTypes(false, true)
testDefinition.DumpValues(false)
Output:

Dump all active field types:
  1, U4, 4, B  ; U4  PE=false MU=false REMOVE=true
  1, B1, 1, F  ; B1  PE=false MU=false REMOVE=true
  1, UB, 1, B  ; UB  PE=false MU=false REMOVE=true
  1, I2, 2, B  ; I2  PE=false MU=false REMOVE=true
  1, U8, 8, B  ; U8  PE=false MU=false REMOVE=true
  1, PG  ; PG  PE=false MU=false REMOVE=true
    2, GC, 1, A  ; GC  PE=false MU=false REMOVE=true
    2, GS, 1, A  ; GS  PE=false MU=false REMOVE=true
    2, GP, 1, P  ; GP  PE=false MU=false REMOVE=true
  1, GM  ; GM  PE=false MU=false REMOVE=true
    2, MA, 1, P  ; MA  PE=false MU=false REMOVE=true

Dump values :   U4 = >0<
 B1 = >0<
 UB = >0<
 I2 = >0<
 U8 = >0<
 PG = [1]
  GC = >0<
  GS = > <
  GP = >0<
 GM = [1]
  MA = >0<
Example (DumpValuesRestrict)
f, err := initLogWithFile("definition.log")
if err != nil {
	fmt.Println("Error init log ", err)
	return
}
defer f.Close()

testDefinition := createLayout()

err = testDefinition.ShouldRestrictToFields("U4,PG")
if err != nil {
	fmt.Println("Error restrict fields ", err)
	return
}
testDefinition.DumpTypes(false, true)
testDefinition.DumpValues(false)
Output:

Dump all active field types:
  1, U4, 4, B  ; U4  PE=false MU=false REMOVE=false
  1, PG  ; PG  PE=false MU=false REMOVE=false
    2, GC, 1, A  ; GC  PE=false MU=false REMOVE=false
    2, GS, 1, A  ; GS  PE=false MU=false REMOVE=false
    2, GP, 1, P  ; GP  PE=false MU=false REMOVE=false

Dump values :   U4 = >0<
 PG = [1]
  GC = >0<
  GS = > <
  GP = >0<

func CreateDefinitionByCache

func CreateDefinitionByCache(reference string) *Definition

CreateDefinitionByCache create definition out of cache if available

func NewDefinition

func NewDefinition() *Definition

NewDefinition create new Definition instance

func NewDefinitionWithTypes

func NewDefinitionWithTypes(types []IAdaType) *Definition

NewDefinitionWithTypes create new Definition instance

func (*Definition) AppendType

func (def *Definition) AppendType(adaType IAdaType)

AppendType append the given type to the type list

func (*Definition) CreateAdabasRequest

func (def *Definition) CreateAdabasRequest(store bool, secondCall bool, mainframe bool) (adabasRequest *Request, err error)

CreateAdabasRequest creates format buffer out of defined metadata tree

func (*Definition) CreateValues

func (def *Definition) CreateValues(forStoring bool) (err error)

CreateValues Create new value tree

func (*Definition) Descriptors

func (def *Definition) Descriptors(descriptors string) (desc []string, err error)

Descriptors Return slice of descriptor field names given

func (*Definition) DumpTypes

func (def *Definition) DumpTypes(doLog bool, activeTree bool)

DumpTypes traverse through the tree of definition calling a callback method

func (*Definition) DumpValues

func (def *Definition) DumpValues(doLog bool)

DumpValues traverse through the tree of values calling a callback method

func (*Definition) Fieldnames added in v1.1.1

func (def *Definition) Fieldnames() []string

Fieldnames list of fields part of the query

func (*Definition) InitReferences

func (def *Definition) InitReferences()

InitReferences Temporary flag inherit on all tree nodes

func (*Definition) ParseBuffer

func (def *Definition) ParseBuffer(helper *BufferHelper, option *BufferOption) (res TraverseResult, err error)

ParseBuffer method start parsing the definition

func (*Definition) PutCache

func (def *Definition) PutCache(reference string)

PutCache put cache entry of current definition

func (*Definition) Search

func (def *Definition) Search(fieldName string) IAdaValue

Search search for a specific field structure in the tree

func (*Definition) SearchByIndex

func (def *Definition) SearchByIndex(fieldName string, index []uint32, create bool) (value IAdaValue, err error)

SearchByIndex search for a specific field structure in the tree of an period group or multiple field

func (*Definition) SearchType

func (def *Definition) SearchType(fieldName string) (adaType IAdaType, err error)

SearchType search for a type definition in the tree

func (*Definition) SetValueWithIndex

func (def *Definition) SetValueWithIndex(name string, index []uint32, x interface{}) error

SetValueWithIndex Add value to an node element

func (*Definition) ShouldRestrictToFieldSlice

func (def *Definition) ShouldRestrictToFieldSlice(field []string) (err error)

ShouldRestrictToFieldSlice Restrict the tree to contain only the given nodes

func (*Definition) ShouldRestrictToFields

func (def *Definition) ShouldRestrictToFields(fields string) (err error)

ShouldRestrictToFields Restrict the tree to contain only the given nodes, remove the value tree

Example
f, err := initLogWithFile("definition.log")
if err != nil {
	return
}
defer f.Close()
InitDefinitionCache()
testDefinition := createPeriodGroupMultiplerField()
testDefinition.PutCache("AA")
testDefinition.DumpTypes(false, false)
testDefinition.DumpTypes(false, true)
err = testDefinition.ShouldRestrictToFields("GC,I8")
if err != nil {
	fmt.Println("Restrict original entry", err)
}
definition := CreateDefinitionByCache("AA")
if definition == nil {
	fmt.Println("Error create cache definition nil")
}
err = definition.ShouldRestrictToFields("GC,I8")
if err != nil {
	fmt.Println("Restrict cached entry error", err)
}
definition.DumpTypes(false, false)
definition.DumpTypes(false, true)
Output:

Dump all file field types:
  1, U4, 4, B  ; U4  PE=false MU=false REMOVE=true
  1, B1, 1, F  ; B1  PE=false MU=false REMOVE=true
  1, UB, 1, B  ; UB  PE=false MU=false REMOVE=true
  1, I2, 2, B  ; I2  PE=false MU=false REMOVE=true
  1, U8, 8, B  ; U8  PE=false MU=false REMOVE=true
  1, GR ,PE ; GR  PE=true MU=true REMOVE=true PE=1-N
    2, GC, 1, A  ; GC  PE=true MU=true REMOVE=true PE=1-N
    2, GM, 5, P ,MU; GM  PE=true MU=true REMOVE=true PE=1-N MU=1-N
      3, GM, 5, P  ; GM  PE=true MU=true REMOVE=true
    2, GS, 1, A  ; GS  PE=true MU=true REMOVE=true PE=1-N
    2, GP, 1, P  ; GP  PE=true MU=true REMOVE=true PE=1-N
  1, I8, 8, B  ; I8  PE=false MU=false REMOVE=true

Dump all active field types:
  1, U4, 4, B  ; U4  PE=false MU=false REMOVE=true
  1, B1, 1, F  ; B1  PE=false MU=false REMOVE=true
  1, UB, 1, B  ; UB  PE=false MU=false REMOVE=true
  1, I2, 2, B  ; I2  PE=false MU=false REMOVE=true
  1, U8, 8, B  ; U8  PE=false MU=false REMOVE=true
  1, GR ,PE ; GR  PE=true MU=true REMOVE=true PE=1-N
    2, GC, 1, A  ; GC  PE=true MU=true REMOVE=true PE=1-N
    2, GM, 5, P ,MU; GM  PE=true MU=true REMOVE=true PE=1-N MU=1-N
      3, GM, 5, P  ; GM  PE=true MU=true REMOVE=true
    2, GS, 1, A  ; GS  PE=true MU=true REMOVE=true PE=1-N
    2, GP, 1, P  ; GP  PE=true MU=true REMOVE=true PE=1-N
  1, I8, 8, B  ; I8  PE=false MU=false REMOVE=true

Dump all file field types:
  1, U4, 4, B  ; U4  PE=false MU=false REMOVE=true
  1, B1, 1, F  ; B1  PE=false MU=false REMOVE=true
  1, UB, 1, B  ; UB  PE=false MU=false REMOVE=true
  1, I2, 2, B  ; I2  PE=false MU=false REMOVE=true
  1, U8, 8, B  ; U8  PE=false MU=false REMOVE=true
  1, GR ,PE ; GR  PE=true MU=true REMOVE=true PE=1-N
    2, GC, 1, A  ; GC  PE=true MU=true REMOVE=true PE=1-N
    2, GM, 5, P ,MU; GM  PE=true MU=true REMOVE=true PE=1-N MU=1-N
      3, GM, 5, P  ; GM  PE=true MU=true REMOVE=true
    2, GS, 1, A  ; GS  PE=true MU=true REMOVE=true PE=1-N
    2, GP, 1, P  ; GP  PE=true MU=true REMOVE=true PE=1-N
  1, I8, 8, B  ; I8  PE=false MU=false REMOVE=true

Dump all active field types:
  1, GR ,PE ; GR  PE=true MU=true REMOVE=true PE=1-N
    2, GC, 1, A  ; GC  PE=true MU=true REMOVE=false PE=1-N
  1, I8, 8, B  ; I8  PE=false MU=false REMOVE=false

func (*Definition) String

func (def *Definition) String() string

String return the content of the definition

func (*Definition) TraverseTypes

func (def *Definition) TraverseTypes(t TraverserMethods, activeTree bool, x interface{}) error

TraverseTypes traverse through the tree of definition calling a callback method

func (*Definition) TraverseValues

func (def *Definition) TraverseValues(t TraverserValuesMethods, x interface{}) (ret TraverseResult, err error)

TraverseValues traverse through the tree of values calling a callback method

type ElementTraverser added in v1.1.1

type ElementTraverser func(value IAdaValue, nr, max int, x interface{}) (TraverseResult, error)

ElementTraverser prepare start of an element

type Error

type Error struct {
	When    time.Time
	Code    string
	Message string
}

Error error message with code and time

func NewGenericError

func NewGenericError(code errorCode, args ...interface{}) *Error

NewGenericError create a genernic non Adabas response error

Example (Print)
f, ferr := initLogWithFile("messages.log")
if ferr != nil {
	fmt.Println(ferr)
	return
}
defer f.Close()

err := NewGenericError(02, "XX")
fmt.Println(err)
fmt.Println("Code", err.Code)
fmt.Println("Message", err.Message)

err = NewGenericError(05)
fmt.Println(err)
fmt.Println("Code", err.Code)
fmt.Println("Message", err.Message)
Output:

ADG0000002: Invalid Adabas command send: XX
Code ADG0000002
Message Invalid Adabas command send: XX
ADG0000005: Repository not defined
Code ADG0000005
Message Repository not defined

func (Error) Error

func (e Error) Error() string

Error error interface function, providing message error code and message. The Adabas error provides message code and message text

type FieldCondition

type FieldCondition struct {
	// contains filtered or unexported fields
}

FieldCondition field condition reference using for parser length management

func NewFieldCondition

func NewFieldCondition(index int, ref int, condition map[byte][]byte) FieldCondition

NewFieldCondition creates a new field condition

type FieldOption

type FieldOption uint32

FieldOption type for field option

const (
	// FieldOptionUQ field option for unique descriptors
	FieldOptionUQ FieldOption = iota
	// FieldOptionNU field option for null suppression
	FieldOptionNU
	// FieldOptionFI field option for fixed size
	FieldOptionFI
	// FieldOptionDE field option for descriptors
	FieldOptionDE
	// FieldOptionNC field option for sql
	FieldOptionNC
	// FieldOptionNN field option for non null
	FieldOptionNN
	// FieldOptionHF field option for high order fields
	FieldOptionHF
	// FieldOptionNV field option for null value
	FieldOptionNV
	// FieldOptionNB field option for
	FieldOptionNB
	// FieldOptionHE field option for
	FieldOptionHE
	// FieldOptionPE field option for period
	FieldOptionPE
	// FieldOptionMU field option for multiple fields
	FieldOptionMU
	// FieldOptionLA field option for large alpha
	FieldOptionLA
	// FieldOptionLB field option for large objects
	FieldOptionLB
	// FieldOptionColExit field option for collation exit
	FieldOptionColExit
)

type FieldType

type FieldType uint

FieldType indicate a field type of the field

const (
	// FieldTypeUndefined field type undefined
	FieldTypeUndefined FieldType = iota
	// FieldTypeUByte field type unsigned byte
	FieldTypeUByte
	// FieldTypeByte field type signed byte
	FieldTypeByte
	// FieldTypeUInt2 field type unsigned integer of 2 bytes
	FieldTypeUInt2
	// FieldTypeInt2 field type signed integer of 2 bytes
	FieldTypeInt2
	// FieldTypeShort field type signed short
	FieldTypeShort
	// FieldTypeUInt4 field type unsigned integer of 4 bytes
	FieldTypeUInt4
	// FieldTypeUInt4Array field type array unsigned integer of 4 bytes
	FieldTypeUInt4Array
	// FieldTypeInt4 field type signed integer of 4 bytes
	FieldTypeInt4
	// FieldTypeUInt8 field type unsigned integer of 8 bytes
	FieldTypeUInt8
	// FieldTypeInt8 field type signed integer of 8 bytes
	FieldTypeInt8
	// FieldTypeLong field type signed long
	FieldTypeLong
	// FieldTypePacked field type packed
	FieldTypePacked
	// FieldTypeUnpacked field type unpacked
	FieldTypeUnpacked
	// FieldTypeDouble field type double
	FieldTypeDouble
	// FieldTypeFloat field type float
	FieldTypeFloat
	// FieldTypeFiller field type for fill gaps between struct types
	FieldTypeFiller
	// FieldTypeString field type string
	FieldTypeString
	// FieldTypeByteArray field type byte array
	FieldTypeByteArray
	// FieldTypeCharacter field type character
	FieldTypeCharacter
	// FieldTypeLength field type for length definitions
	FieldTypeLength
	// FieldTypeUnicode field type unicode string
	FieldTypeUnicode
	// FieldTypeLAUnicode field type unicode large objects
	FieldTypeLAUnicode
	// FieldTypeLBUnicode field type unicode LOB
	FieldTypeLBUnicode
	// FieldTypeLAString field type string large objects
	FieldTypeLAString
	// FieldTypeLBString field type string LOB
	FieldTypeLBString
	// FieldTypeFieldLength field length
	FieldTypeFieldLength
	// FieldTypePeriodGroup field type period group
	FieldTypePeriodGroup
	// FieldTypeMultiplefield field type multiple fields
	FieldTypeMultiplefield
	// FieldTypeStructure field type of structured types
	FieldTypeStructure
	// FieldTypeGroup field type group
	FieldTypeGroup
	// FieldTypePackedArray field type packed array
	FieldTypePackedArray
	// FieldTypePhonetic field type of phonetic descriptor
	FieldTypePhonetic
	// FieldTypeSuperDesc field type of super descriptors
	FieldTypeSuperDesc
	// FieldTypeLiteral field type of literal data send to database
	FieldTypeLiteral
	// FieldTypeFieldCount field type to defined field count of MU or PE fields
	FieldTypeFieldCount
	// FieldTypeHyperDesc field type of Hyper descriptors
	FieldTypeHyperDesc
	// FieldTypeReferential field type for referential integrity
	FieldTypeReferential
	// FieldTypeCollation field type of collation descriptors
	FieldTypeCollation
	// FieldTypeFunction field type to define functions working on result list
	FieldTypeFunction
)

func (FieldType) FormatCharacter

func (fieldType FieldType) FormatCharacter() string

FormatCharacter format character use to output FDT

type FlagOption

type FlagOption uint

FlagOption flag option used to omit traversal through the tree (example is MU and PE)

const (
	// FlagOptionPE indicate tree is part of period group
	FlagOptionPE FlagOption = iota
	// FlagOptionMU indicate tree contains MU fields
	FlagOptionMU
	// FlagOptionMUGhost ghost field for MU
	FlagOptionMUGhost
	// FlagOptionToBeRemoved should be removed
	FlagOptionToBeRemoved
	// FlagOptionSecondCall Field will need a second call to get the value
	FlagOptionSecondCall
)

func (FlagOption) Bit

func (flagOption FlagOption) Bit() uint8

Bit return the Bit of the option flag

type HoldType added in v1.1.2

type HoldType uint32

HoldType hold enum type

const (
	// HoldNone no hold
	HoldNone HoldType = iota
	// HoldWait wait for hold released
	HoldWait
	// HoldResponse receive response code
	HoldResponse
)

type IAdaType

type IAdaType interface {
	Type() FieldType
	String() string
	Name() string
	ShortName() string
	SetName(string)
	Value() (IAdaValue, error)
	Length() uint32
	SetLength(uint32)
	SetRange(*AdaRange)
	IsStructure() bool
	Level() uint8
	SetLevel(uint8)
	Option() string
	SetParent(IAdaType)
	GetParent() IAdaType
	HasFlagSet(FlagOption) bool
	AddFlag(FlagOption)
	RemoveFlag(FlagOption)
	IsOption(FieldOption) bool
	AddOption(FieldOption)
	IsSpecialDescriptor() bool
	SetEndian(binary.ByteOrder)
	Endian() binary.ByteOrder
}

IAdaType data type interface defined for all types

Example (SetValue)
f, err := initLogWithFile("unpacked.log")
if err != nil {
	fmt.Println("Error enable log")
	return
}
defer f.Close()

adaType := NewType(FieldTypeInt8, "I8")
up := newInt8Value(adaType)
fmt.Println("Integer default value :", up.value)
up.SetValue(1000)
fmt.Printf("Integer 1000 value : %d %T\n", up.value, up.value)
up.SetValue(int64(math.MinInt64))
fmt.Printf("Integer minimal value : %d %T\n", up.value, up.value)
up.SetValue(int64(math.MaxInt64))
fmt.Printf("Integer maximal value : %d %T\n", up.value, up.value)
err = up.SetValue(int8(10))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 10 (8bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(int16(100))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 100 (16bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(int32(1000))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 1000 (32bit) value : %d %T\n", up.value, up.value)
err = up.SetValue("87654")
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 87654 (string) value : %d %T\n", up.value, up.value)
err = up.SetValue(uint8(10))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 10 (8bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(uint16(100))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 100 (16bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(uint32(1000))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 1000 (32bit) value : %d %T\n", up.value, up.value)
err = up.SetValue([]byte{0x50})
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 80 (1-byte array) value : %d %T\n", up.value, up.value)
err = up.SetValue([]byte{0xfe})
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer -2 (1-byte array) value : %d %T\n", up.value, up.value)
err = up.SetValue([]byte{0x50, 0x2})
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 592 (2-byte array) value : %d %T\n", up.value, up.value)
err = up.SetValue([]byte{0x50, 0x2, 0x3, 0x4})
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 67306064 (4-byte array) value : %d %T\n", up.value, up.value)
Output:

	Integer default value : 0
Integer 1000 value : 1000 int64
Integer minimal value : -9223372036854775808 int64
Integer maximal value : 9223372036854775807 int64
Integer 10 (8bit) value : 10 int64
Integer 100 (16bit) value : 100 int64
Integer 1000 (32bit) value : 1000 int64
Integer 87654 (string) value : 87654 int64
Integer 10 (8bit) value : 10 int64
Integer 100 (16bit) value : 100 int64
Integer 1000 (32bit) value : 1000 int64
Integer 80 (1-byte array) value : 80 int64
Integer -2 (1-byte array) value : -2 int64
Integer 592 (2-byte array) value : 592 int64
Integer 67306064 (4-byte array) value : 67306064 int64
Example (Uint8SetValue)
f, err := initLogWithFile("unpacked.log")
if err != nil {
	fmt.Println("Error enable log")
	return
}
defer f.Close()

adaType := NewType(FieldTypeUInt8, "U8")
up := newUInt8Value(adaType)
fmt.Println("Unsigned Integer default value :", up.value)
up.SetValue(1000)
fmt.Printf("Integer 1000 value : %d %T\n", up.value, up.value)
err = up.SetValue(int64(math.MinInt64))
if err == nil {
	fmt.Println("ERROR: negative value should be cause error")
	return
}
fmt.Println(err)
up.SetValue(int64(math.MaxInt64))
fmt.Printf("Integer maximal value : %d %T\n", up.value, up.value)
err = up.SetValue(int8(10))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 10 (8bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(int16(100))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 100 (16bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(int32(1000))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 1000 (32bit) value : %d %T\n", up.value, up.value)
err = up.SetValue("87654")
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 87654 (string) value : %d %T\n", up.value, up.value)
err = up.SetValue(uint8(10))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 10 (8bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(uint16(100))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 100 (16bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(uint32(1000))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 1000 (32bit) value : %d %T\n", up.value, up.value)
err = up.SetValue(uint8(80))
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 80 (1-byte array) value : %d %T\n", up.value, up.value)
err = up.SetValue([]byte{0xfe})
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 254 (1-byte array) value : %d %T\n", up.value, up.value)
err = up.SetValue([]byte{0x50, 0x2})
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 592 (2-byte array) value : %d %T\n", up.value, up.value)
err = up.SetValue([]byte{0x50, 0x2, 0x3, 0x4})
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("Integer 67306064 (4-byte array) value : %d %T\n", up.value, up.value)
Output:

	Unsigned Integer default value : 0
Integer 1000 value : 1000 uint64
ADG0000101: Cannot convert negative value to unsigned of type int64
Integer maximal value : 9223372036854775807 uint64
Integer 10 (8bit) value : 10 uint64
Integer 100 (16bit) value : 100 uint64
Integer 1000 (32bit) value : 1000 uint64
Integer 87654 (string) value : 87654 uint64
Integer 10 (8bit) value : 10 uint64
Integer 100 (16bit) value : 100 uint64
Integer 1000 (32bit) value : 1000 uint64
Integer 80 (1-byte array) value : 80 uint64
Integer 254 (1-byte array) value : 254 uint64
Integer 592 (2-byte array) value : 592 uint64
Integer 67306064 (4-byte array) value : 67306064 uint64

type IAdaValue

type IAdaValue interface {
	Type() IAdaType
	String() string
	Bytes() []byte
	PeriodIndex() uint32

	MultipleIndex() uint32
	FormatBuffer(buffer *bytes.Buffer, option *BufferOption) uint32
	Value() interface{}
	SetParent(parentAdaValue IAdaValue)
	SetStringValue(string)
	SetValue(interface{}) error
	StoreBuffer(*BufferHelper) error
	// Int32 convert current Adabas value into integer value if possible, if not fill error
	Int32() (int32, error)
	UInt32() (uint32, error)
	Int64() (int64, error)
	UInt64() (uint64, error)
	Float() (float64, error)
	// contains filtered or unexported methods
}

IAdaValue defines standard interface for all values

type ISearchNode

type ISearchNode interface {
	String() string
	// contains filtered or unexported methods
}

ISearchNode interface for adding search tree or nodes into tree

type Isn

type Isn uint64

Isn Adabas Internal ISN

type Log

type Log interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
}

Log defines the log interface to manage other Log output frameworks

type Platform

type Platform struct {
	// contains filtered or unexported fields
}

Platform platform definition structure

func NewPlatform

func NewPlatform(arch byte) *Platform

NewPlatform create a new platform instance

func NewPlatformIsl

func NewPlatformIsl(isl uint64) *Platform

NewPlatformIsl create a new platform instance

func (*Platform) IsMainframe

func (platform *Platform) IsMainframe() bool

IsMainframe returns True if the platform is a Mainframe platform

type PrepareTraverser added in v1.1.1

type PrepareTraverser func(t interface{}, x interface{}) (TraverseResult, error)

PrepareTraverser prepare giving current main object

type Request added in v1.1.1

type Request struct {
	FormatBuffer       bytes.Buffer
	RecordBuffer       *BufferHelper
	RecordBufferLength uint32
	RecordBufferShift  uint32
	PeriodLength       uint32
	SearchTree         *SearchTree
	Parser             RequestParser
	HoldRecords        HoldType
	Limit              uint64
	Multifetch         uint32
	Descriptors        []string
	Definition         *Definition
	Response           uint16
	Isn                Isn
	IsnQuantity        uint64
	Option             *BufferOption
}

Request contains all relevant buffer and parameters for a Adabas call

func (*Request) GetValue added in v1.1.1

func (adabasRequest *Request) GetValue(name string) (IAdaValue, error)

GetValue get the value for string with name

type RequestParser

type RequestParser func(adabasRequest *Request, x interface{}) error

RequestParser function callback used to go through the list of received buffer

type SearchInfo

type SearchInfo struct {
	Definition *Definition
	NeedSearch bool
	// contains filtered or unexported fields
}

SearchInfo structure containing search parameters

func NewSearchInfo

func NewSearchInfo(platform *Platform, search string) *SearchInfo

NewSearchInfo new search info base to create search tree

func (*SearchInfo) GenerateTree

func (searchInfo *SearchInfo) GenerateTree() (tree *SearchTree, err error)

GenerateTree generate tree search information

type SearchNode

type SearchNode struct {
	// contains filtered or unexported fields
}

SearchNode node entry in the searchtree

func (*SearchNode) String

func (node *SearchNode) String() string

type SearchTree

type SearchTree struct {
	// contains filtered or unexported fields
}

SearchTree tree entry point

func (*SearchTree) OrderBy

func (tree *SearchTree) OrderBy() []string

OrderBy provide list of descriptor names for this search

func (*SearchTree) SearchBuffer

func (tree *SearchTree) SearchBuffer() string

SearchBuffer returns search buffer of the search tree

func (*SearchTree) SearchFields

func (tree *SearchTree) SearchFields() []string

SearchFields provide list of field names for this search

func (*SearchTree) String

func (tree *SearchTree) String() string

String provide string of search tree

func (*SearchTree) ValueBuffer

func (tree *SearchTree) ValueBuffer(buffer *bytes.Buffer)

ValueBuffer returns value buffer of the search tree

type SearchValue

type SearchValue struct {
	// contains filtered or unexported fields
}

SearchValue value endpoint

func (*SearchValue) String

func (value *SearchValue) String() string

String shows the current value of the search value

type Stack

type Stack struct {
	Size int
	// contains filtered or unexported fields
}

Stack stack creates structure

func NewStack

func NewStack() *Stack

NewStack creates a new stack instance

func (*Stack) Clear

func (s *Stack) Clear()

Clear Clear the stack

func (*Stack) Pop

func (s *Stack) Pop() (interface{}, error)

Pop pop a new element out of stack. If empty a nil interface is returned. Error is indicating the case

func (*Stack) Push

func (s *Stack) Push(v interface{})

Push push a new element into stack

type StructureType

type StructureType struct {
	CommonType

	SubTypes []IAdaType
	// contains filtered or unexported fields
}

StructureType creates a new structure type

func NewLongNameStructureList

func NewLongNameStructureList(fType FieldType, name string, shortName string, occByteShort int16, subFields []IAdaType) *StructureType

NewLongNameStructureList Creates a new object of structured list types

func NewStructure

func NewStructure() *StructureType

NewStructure Creates a new object of structured list types

func NewStructureCondition

func NewStructureCondition(fType FieldType, name string, subFields []IAdaType, condition FieldCondition) *StructureType

NewStructureCondition Creates a new object of structured list types

func NewStructureEmpty

func NewStructureEmpty(fType FieldType, name string, occByteShort int16,
	level uint8) *StructureType

NewStructureEmpty Creates a new object of structured list types

func NewStructureList

func NewStructureList(fType FieldType, name string, occByteShort int16, subFields []IAdaType) *StructureType

NewStructureList Creates a new object of structured list types

func (*StructureType) AddField

func (adaType *StructureType) AddField(fieldType IAdaType)

AddField add a new field type into the structure type

func (*StructureType) IsStructure

func (adaType *StructureType) IsStructure() bool

IsStructure return the structure of the field

func (*StructureType) Length

func (adaType *StructureType) Length() uint32

Length returns the length of the field

func (*StructureType) NrFields

func (adaType *StructureType) NrFields() int

NrFields number of fields contained in the structure

func (*StructureType) Option

func (adaType *StructureType) Option() string

Option return structure option as a string

func (*StructureType) RemoveField

func (adaType *StructureType) RemoveField(fieldType *CommonType)

RemoveField remote field of the structure type

func (*StructureType) SetLength

func (adaType *StructureType) SetLength(length uint32)

SetLength set the length of the field

func (*StructureType) SetRange added in v1.1.1

func (adaType *StructureType) SetRange(r *AdaRange)

SetRange set Adabas range

func (*StructureType) String

func (adaType *StructureType) String() string

String return the name of the field

func (*StructureType) Traverse

func (adaType *StructureType) Traverse(t TraverserMethods, level int, x interface{}) (err error)

Traverse Traverse through the definition tree calling a callback method for each node

func (*StructureType) Value

func (adaType *StructureType) Value() (adaValue IAdaValue, err error)

Value return type specific value structure object

type StructureValue

type StructureValue struct {
	Elements []*structureElement
	// contains filtered or unexported fields
}

StructureValue structure value struct

func (*StructureValue) Bytes

func (value *StructureValue) Bytes() []byte

Bytes byte array representation of the value

func (*StructureValue) Float

func (value *StructureValue) Float() (float64, error)

Float not used

func (*StructureValue) FormatBuffer

func (value *StructureValue) FormatBuffer(buffer *bytes.Buffer, option *BufferOption) uint32

FormatBuffer provide the format buffer of this structure

func (*StructureValue) Get

func (value *StructureValue) Get(fieldName string, index int) IAdaValue

Get get the value of an named tree node with an specific index

func (*StructureValue) Int32

func (value *StructureValue) Int32() (int32, error)

Int32 not used

func (*StructureValue) Int64

func (value *StructureValue) Int64() (int64, error)

Int64 not used

func (StructureValue) MultipleIndex

func (adavalue StructureValue) MultipleIndex() uint32

func (*StructureValue) NrElements

func (value *StructureValue) NrElements() int

NrElements number of structure values

func (*StructureValue) NrValues

func (value *StructureValue) NrValues(index uint32) int

NrValues number of structure values

func (*StructureValue) PeriodIndex

func (value *StructureValue) PeriodIndex() uint32

PeriodIndex returns the period index of the structured value

func (*StructureValue) SetParent

func (adavalue *StructureValue) SetParent(parentAdaValue IAdaValue)

func (*StructureValue) SetStringValue

func (value *StructureValue) SetStringValue(stValue string)

SetStringValue set the string value of the value

func (*StructureValue) SetValue

func (value *StructureValue) SetValue(v interface{}) error

SetValue set value for structure

func (*StructureValue) StoreBuffer

func (value *StructureValue) StoreBuffer(helper *BufferHelper) error

StoreBuffer generate store buffer

func (*StructureValue) String

func (value *StructureValue) String() string

func (*StructureValue) Traverse

func (value *StructureValue) Traverse(t TraverserValuesMethods, x interface{}) (ret TraverseResult, err error)

Traverse Traverse through the definition tree calling a callback method for each node

func (StructureValue) Type

func (adavalue StructureValue) Type() IAdaType

func (*StructureValue) UInt32

func (value *StructureValue) UInt32() (uint32, error)

UInt32 not used

func (*StructureValue) UInt64

func (value *StructureValue) UInt64() (uint64, error)

UInt64 not used

func (*StructureValue) Value

func (value *StructureValue) Value() interface{}

Value return the values of an structure value

type TraverseResult

type TraverseResult int

TraverseResult Traverser result operation

const (
	// Continue continue traversing the tree
	Continue TraverseResult = iota
	// EndTraverser end the traverser
	EndTraverser
	// SkipStructure skip all other elements of an structure
	SkipStructure
	// SkipTree skip tree of the structure value
	SkipTree
)

type Traverser

type Traverser func(adaType IAdaType, parentType IAdaType, level int, x interface{}) error

Traverser api to handle tree traverses for type definitions

type TraverserMethods

type TraverserMethods struct {
	EnterFunction Traverser
	// contains filtered or unexported fields
}

TraverserMethods structure for Traverser types

func NewTraverserMethods

func NewTraverserMethods(enter Traverser) TraverserMethods

NewTraverserMethods new traverser methods structure

type TraverserValues

type TraverserValues func(value IAdaValue, x interface{}) (TraverseResult, error)

TraverserValues api to handle tree traverses for values

type TraverserValuesMethods

type TraverserValuesMethods struct {
	PrepareFunction PrepareTraverser
	EnterFunction   TraverserValues
	LeaveFunction   TraverserValues
	ElementFunction ElementTraverser
}

TraverserValuesMethods structure for Traverser values

Notes

Bugs

  • Check if fields are valid!!!!

Jump to

Keyboard shortcuts

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