Documentation
¶
Overview ¶
Package def contains interfaces defining the basic types in duo and other global information
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Dbg = NewDebug()
Dbg is a variable available to any importing this package to enabling debug printing for error status prints and miscellaneous
var StringCodingTypes = []string{
"byte",
"string",
"decimal",
"hex",
"base32",
"base58",
"base58check",
"base64",
}
StringCodingTypes is the types of encoding available, append only to add new ones for compatibility
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array interface {
Elem(int) interface{} // returns a buffer containing the numbered array element
Len() int // returns the length of the array
SetElem(int, interface{}) interface{} // loads the buffer at the given index
}
Array is an interface for working with data that can be split into multiple identical typed subunits.
type Buffer ¶
type Buffer interface {
Buf() interface{} // returns the pointer to the slice it represents
Copy(interface{}) Buffer // duplicates a passed buffer
Free() Buffer // dereferences the buffer
Len() int // returns the byte length of the buffer
Link(Buffer) Buffer // copies the pointer of another Buffer
OfLen(int) Buffer // creates a new empty buffer of a given size
Null() Buffer // zeroes out the buffer
Rand(...int) Buffer // loads the buffer with random bytes
Coding() Coding // Defines output encoding for the stringer
Status() Status // Embeds error handling
Array() Array // Allows the addressing of a buffer as a list of uniform sized subunits
String() (S string) // renders a string from the buffer
}
Buffer is a generic interface for structs that contain *[]byte elements
type Coding ¶
type Coding interface {
Get() string // returns the current coding type
Set(string) Coding // sets the coding type
List() []string // returns an array of strings representing available coding types
}
Coding is an interface for data types that have multiple string output formats
type Debug ¶
type Debug struct {
// contains filtered or unexported fields
}
Debug is an object that can be embedded into types to provide a debug print service for error status reporting
type ErrorStatus ¶
type ErrorStatus struct {
Err error
}
ErrorStatus is a status getter/setter for controlling the error string
func (*ErrorStatus) Error ¶
func (r *ErrorStatus) Error() string
Error returns the error field of a Status
func (*ErrorStatus) Set ¶
func (r *ErrorStatus) Set(s ...interface{}) interface{}
Set the status string/error
type Status ¶
type Status interface {
Set(...interface{}) interface{} // sets the string that is returned by Error()
Unset() interface{} // clears error to represent the nominal state
Error() string // returns the error field of a Status
}
Status is an extension of the Error interface that also adds getting and setting
type StringCoding ¶
type StringCoding int
StringCoding is a coding type for converting data to strings
func (StringCoding) List ¶
func (r StringCoding) List() (R []string)
List returns an array of strings representing available coding