utility

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: Apache-2.0 Imports: 9 Imported by: 10

README

GoLang_Utility

It provides following utility class

  • StringBuilder: like StringBuilder on Java, but it has only minimum functions for me
  • LogUtil: for management output log

Version history

  • 2016.03.18 v0.0.1: release
  • 2017.11.28 v0.0.2: bug fix
  • 2018.02.08 v0.1.0: add ReflectHelper
  • 2018.02.09 v1.0.0: add unit test

Documentation

Overview

LogUtil.go

Index

Constants

View Source
const LogLevelD = 15
View Source
const LogLevelE = 1
View Source
const LogLevelI = 7
View Source
const LogLevelV = 31
View Source
const LogLevelW = 3

Variables

View Source
var EnableDebug bool = true

Functions

func CamelToSnakeCase added in v1.1.0

func CamelToSnakeCase(text string) string

func ChangeLogLevel

func ChangeLogLevel(logLevel int)

func ChangeLogLevelByText added in v1.4.3

func ChangeLogLevelByText(logLevelText string)

func GetLogLevel

func GetLogLevel() int

func LogD

func LogD(content string)

func LogE

func LogE(content string)

func LogI

func LogI(content string)

func LogInit

func LogInit()

func LogV

func LogV(content string)

func LogW

func LogW(content string)

func SnakeToCamelCase added in v1.1.0

func SnakeToCamelCase(text string) string

func Split added in v1.5.0

func Split(originalText string, sepTextArray []string, invalidSpaceStarters []rune, caseSensitive bool) [][]rune

func ToLowerFirst added in v1.2.0

func ToLowerFirst(text string) string

func ToUpperFirst added in v1.2.0

func ToUpperFirst(text string) string

func Version added in v1.0.0

func Version() string

func VersionMajorCode added in v1.0.0

func VersionMajorCode() int

func VersionMinorCode added in v1.0.0

func VersionMinorCode() int

func VersionRevisionCode added in v1.0.0

func VersionRevisionCode() int

Types

type ConfigHelper added in v1.4.2

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

func NewConfigHelper added in v1.4.2

func NewConfigHelper(configData interface{}, configFilePath string) *ConfigHelper

func (*ConfigHelper) ExpandConfigData added in v1.4.2

func (helper *ConfigHelper) ExpandConfigData() error

type Logger

type Logger struct {
	LogLevel int
	// contains filtered or unexported fields
}

func (Logger) ChangeLogLevel

func (this Logger) ChangeLogLevel(logLevel int)

func (Logger) ChangeLogLevelByText added in v1.4.3

func (this Logger) ChangeLogLevelByText(logLevelText string)

func (Logger) GetLogLevel

func (this Logger) GetLogLevel() int

func (Logger) LogD

func (this Logger) LogD(content string)

func (Logger) LogE

func (this Logger) LogE(content string)

func (Logger) LogI

func (this Logger) LogI(content string)

func (Logger) LogV

func (this Logger) LogV(content string)

func (Logger) LogW

func (this Logger) LogW(content string)

type LoggerIF

type LoggerIF interface {
	GetLogLevel() int
	ChangeLogLevel(logLevel int)
	LogV(content string)
	LogD(content string)
	LogI(content string)
	LogW(content string)
	LogE(content string)
	// contains filtered or unexported methods
}

type ReflectHelper added in v0.1.0

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

func NewReflectHelper added in v0.1.0

func NewReflectHelper(targetInterface interface{}) *ReflectHelper

func (*ReflectHelper) BoolValue added in v0.1.0

func (this *ReflectHelper) BoolValue(index int) bool

func (*ReflectHelper) Call added in v1.3.0

func (this *ReflectHelper) Call(methodName string, values []reflect.Value) []reflect.Value

func (*ReflectHelper) CanSet added in v0.1.0

func (this *ReflectHelper) CanSet(name string, value interface{}) bool

func (*ReflectHelper) FloatValue added in v0.1.0

func (this *ReflectHelper) FloatValue(index int) float64

func (*ReflectHelper) GetByIndex added in v0.1.0

func (this *ReflectHelper) GetByIndex(index int) interface{}

func (*ReflectHelper) GetByName added in v0.1.0

func (this *ReflectHelper) GetByName(name string) interface{}

func (*ReflectHelper) GetByTagName added in v1.3.1

func (this *ReflectHelper) GetByTagName(key string, name string) interface{}

func (*ReflectHelper) IntValue added in v0.1.0

func (this *ReflectHelper) IntValue(index int) int64

func (*ReflectHelper) InterfaceName added in v0.1.0

func (this *ReflectHelper) InterfaceName() string

func (*ReflectHelper) IsBool added in v0.1.0

func (this *ReflectHelper) IsBool(index int) bool

func (*ReflectHelper) IsFloat32 added in v0.1.0

func (this *ReflectHelper) IsFloat32(index int) bool

func (*ReflectHelper) IsFloat64 added in v0.1.0

func (this *ReflectHelper) IsFloat64(index int) bool

func (*ReflectHelper) IsInt8 added in v0.1.0

func (this *ReflectHelper) IsInt8(index int) bool

func (*ReflectHelper) IsInt16 added in v0.1.0

func (this *ReflectHelper) IsInt16(index int) bool

func (*ReflectHelper) IsInt32 added in v0.1.0

func (this *ReflectHelper) IsInt32(index int) bool

func (*ReflectHelper) IsInt64 added in v0.1.0

func (this *ReflectHelper) IsInt64(index int) bool

func (*ReflectHelper) IsString added in v0.1.0

func (this *ReflectHelper) IsString(index int) bool

func (*ReflectHelper) IsUint8 added in v0.1.0

func (this *ReflectHelper) IsUint8(index int) bool

func (*ReflectHelper) IsUint16 added in v0.1.0

func (this *ReflectHelper) IsUint16(index int) bool

func (*ReflectHelper) IsUint32 added in v0.1.0

func (this *ReflectHelper) IsUint32(index int) bool

func (*ReflectHelper) IsUint64 added in v0.1.0

func (this *ReflectHelper) IsUint64(index int) bool

func (*ReflectHelper) Name added in v0.1.0

func (this *ReflectHelper) Name(index int) string

func (*ReflectHelper) NumField added in v0.1.0

func (this *ReflectHelper) NumField() int

func (*ReflectHelper) SetByIndex added in v0.1.0

func (this *ReflectHelper) SetByIndex(index int, value interface{}) bool

func (*ReflectHelper) SetByName added in v0.1.0

func (this *ReflectHelper) SetByName(name string, value interface{}) bool

func (*ReflectHelper) String added in v0.1.0

func (this *ReflectHelper) String(index int) string

func (*ReflectHelper) StringValue added in v0.1.0

func (this *ReflectHelper) StringValue(index int) string

func (*ReflectHelper) Tag added in v0.1.0

func (this *ReflectHelper) Tag(index int) reflect.StructTag

func (*ReflectHelper) UintValue added in v0.1.0

func (this *ReflectHelper) UintValue(index int) uint64

func (*ReflectHelper) ValueKind added in v0.1.0

func (this *ReflectHelper) ValueKind(index int) reflect.Kind

type ReflectHelperIF added in v0.1.0

type ReflectHelperIF interface {
	NumField() int
	InterfaceName() string
	Name(index int) string
	Tag(index int) reflect.StructTag
	BoolValue(index int) bool
	StringValue(index int) string
	String(index int) string
	IntValue(index int) int64
	UintValue(index int) uint64
	FloatValue(index int) float64

	ValueKind(index int) reflect.Kind
	IsBool(index int) bool
	IsString(index int) bool
	IsInt32(index int) bool
	IsInt64(index int) bool
	IsUint32(index int) bool
	IsUint64(index int) bool
	IsFloat32(index int) bool
	IsFloat64(index int) bool

	SetByName(name string, value interface{})
	SetByIndex(index int, value interface{})
	GetByName(name string) interface{}
	GetByTagName(key string, name string) interface{}
	GetByIndex(index int) interface{}

	FindByName(name string) bool
	Call(methodName string, values []reflect.Value) []reflect.Value
}

type StringBuilder

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

func (*StringBuilder) Append

func (this *StringBuilder) Append(text string) *StringBuilder

func (*StringBuilder) AppendByte added in v1.1.0

func (this *StringBuilder) AppendByte(text byte) *StringBuilder

func (*StringBuilder) Bytes added in v1.0.0

func (this *StringBuilder) Bytes() []byte

func (*StringBuilder) Delete

func (this *StringBuilder) Delete()

func (*StringBuilder) Length added in v1.0.0

func (this *StringBuilder) Length() int

func (*StringBuilder) String

func (this *StringBuilder) String() string

type StringBuilderIF

type StringBuilderIF interface {
	Append(text string) StringBuilder
	AppendByte(text byte) StringBuilder
	Delete()
	String() string
	Length() int
	Bytes() []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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