utils

package
v0.0.0-...-847bbec Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var INDEX_END byte = 122
View Source
var INDEX_START byte = 48
View Source
var NO_COLORS bool = false

Functions

func CmdParse

func CmdParse(key string) (string, error)

func CorrectInput

func CorrectInput(input string) string

func CreateNewEmptyFile

func CreateNewEmptyFile(file string) error

func ExportStructureToFile

func ExportStructureToFile(File string, Format string, structure interface{}) error

func GetJSONFromElem

func GetJSONFromElem(m interface{}, prettify bool) ([]byte, error)

go binary decoder

func GetJSONFromObj

func GetJSONFromObj(m interface{}, prettify bool) []byte

go binary decoder

func GetXMLFromElem

func GetXMLFromElem(m interface{}, prettify bool) ([]byte, error)

func GetXMLFromObj

func GetXMLFromObj(m interface{}, prettify bool) []byte

func GetYAMLFromElem

func GetYAMLFromElem(m interface{}) ([]byte, error)

func GetYAMLFromObj

func GetYAMLFromObj(m interface{}) []byte

func IdToFileFormat

func IdToFileFormat(id string) string

func IntToString

func IntToString(n int) string

func NameToFileFormat

func NameToFileFormat(id string) string

func NewByteStreamAsWriter

func NewByteStreamAsWriter(b []byte) *bufio.Writer

func OptionsParse

func OptionsParse(key string, val string) (string, string, error)

func PrintError

func PrintError(text string)

func PrintImportant

func PrintImportant(text string)

func PrintInfo

func PrintInfo(text string)

func PrintSuccess

func PrintSuccess(text string)

func PrintWarning

func PrintWarning(text string)

func PrintlnBoldError

func PrintlnBoldError(text string)

func PrintlnError

func PrintlnError(text string)

func PrintlnImportant

func PrintlnImportant(text string)

func PrintlnInfo

func PrintlnInfo(text string)

func PrintlnSuccess

func PrintlnSuccess(text string)

func PrintlnWarning

func PrintlnWarning(text string)

func ReduceStruct

func ReduceStruct(field string, list []interface{}) ([]interface{}, error)

func ReducedToIntsSlice

func ReducedToIntsSlice(reduced []interface{}) []int

func ReducedToStringsSlice

func ReducedToStringsSlice(reduced []interface{}) []string

func RequestConfirmation

func RequestConfirmation(reason string) bool

func ReverseBytesArray

func ReverseBytesArray(bytesArray []byte) []byte

func ReverseString

func ReverseString(str string) string

func StrPad

func StrPad(instr string, capping int) string

func StringToInt

func StringToInt(s string) (int, error)

func ToMap

func ToMap(m interface{}) map[string]interface{}

Types

type ByteStream

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

func NewByteStream

func NewByteStream(b []byte) *ByteStream

func (*ByteStream) Bytes

func (buffer *ByteStream) Bytes() []byte

func (*ByteStream) Read

func (buffer *ByteStream) Read(b []byte) (n int, err error)

Read reads up to len(b) bytes from the ByteStream. It returns the number of bytes read and any error encountered. At end of file, Read returns 0, io.EOF.

func (*ByteStream) ReadAt

func (buffer *ByteStream) ReadAt(b []byte, off int64) (int, error)

ReadAt reads len(b) bytes from the ByteStream starting at byte offset ofbuffer. It returns the number of bytes read and the error, if any. ReadAt always returns a non-nil error when n < len(b). At end of file, that error is io.EOF.

func (*ByteStream) Reset

func (buffer *ByteStream) Reset()

func (*ByteStream) Seek

func (buffer *ByteStream) Seek(offset int64, whence int) (int64, error)

Seek sets the offset for the next Read or Write on file to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end.

func (*ByteStream) String

func (buffer *ByteStream) String() string

func (*ByteStream) Write

func (buffer *ByteStream) Write(b []byte) (n int, err error)

Write writes len(b) bytes to the ByteStream. It returns the number of bytes written and an error, if any. Write returns a non-nil error when n != len(b).

func (*ByteStream) WriteAt

func (buffer *ByteStream) WriteAt(b []byte, off int64) (int, error)

WriteAt writes len(b) bytes to the ByteStream starting at byte offset ofbuffer. It returns the number of bytes written and an error, if any. WriteAt returns a non-nil error when n != len(b).

func (*ByteStream) WriteString

func (buffer *ByteStream) WriteString(s string) (int, error)

WriteString is like Write, but writes the contents of string s rather than a slice of bytes.

type Index

type Index struct {
	Value string
}

func (*Index) Compare

func (element *Index) Compare(index Index) int

func (*Index) FromInt

func (element *Index) FromInt(value int, length int)

func (*Index) IsMaxValue

func (element *Index) IsMaxValue() bool

func (*Index) IsZero

func (element *Index) IsZero() bool

func (*Index) New

func (element *Index) New(size int)

func (*Index) Next

func (element *Index) Next() Index

func (*Index) Previous

func (element *Index) Previous() Index

func (*Index) Subtract

func (element *Index) Subtract(index Index)

func (*Index) Sum

func (element *Index) Sum(index Index)

Jump to

Keyboard shortcuts

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