jgo

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 5 Imported by: 0

README

test.golang

test golang core

Documentation

Overview

Package jgo

util: common tool

sys: system tool

log: log tool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map type of map[string]interface{}

func (*Map) ConvertTo

func (m *Map) ConvertTo(output interface{})

ConvertTo same as mapstructure.Decode. output must be a pointer to a map or struct.

func (*Map) GetMap

func (m *Map) GetMap(arg ...interface{}) *Map

GetMap get value of Map struct. arg must be map key or slice index.

func (*Map) GetSlice

func (m *Map) GetSlice(arg ...interface{}) *Slice

GetSlice get value of Slice struct. arg must be map key or slice index.

func (*Map) GetValue

func (m *Map) GetValue(arg ...interface{}) interface{}

GetValue get source value. arg must be map key or slice index.

func (*Map) Overwrite

func (m *Map) Overwrite(src *Map) *Map

Overwrite get the overwritten maps. return a new map after overwriting from src to self

func (*Map) ToString

func (m *Map) ToString(arg ...interface{}) string

ToString translate Map value to string. arg must be map key or slice index.

type Slice

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

Slice type of []interface{}

func (*Slice) ConvertTo

func (s *Slice) ConvertTo(output interface{})

ConvertTo same as mapstructure.Decode. output must be a pointer to a map or struct.

func (*Slice) Filter

func (s *Slice) Filter(f func(interface{}) bool) *Slice

Filter get slice after filter.

func (*Slice) GetMap

func (s *Slice) GetMap(arg ...interface{}) *Map

GetMap get value of Map struct. arg must be map key or slice index.

func (*Slice) GetSlice

func (s *Slice) GetSlice(arg ...interface{}) *Slice

GetSlice get value of Slice struct. arg must be map key or slice index.

func (*Slice) GetValue

func (s *Slice) GetValue(arg ...interface{}) interface{}

GetValue get source value. arg must be map key or slice index.

func (*Slice) ToString

func (s *Slice) ToString(arg ...interface{}) string

ToString translate Slice value to string. arg must be map key or slice index.

type Sys

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

func GetSys

func GetSys() *Sys

func (*Sys) Env

func (s *Sys) Env() string

func (*Sys) EnvValid

func (s *Sys) EnvValid() bool

type Util

type Util struct{}

func (Util) ByteArrayToMap

func (u Util) ByteArrayToMap(data []byte) *Map

ByteArrayToMap byte array to Map structure

func (*Util) JsonFileToMap

func (u *Util) JsonFileToMap(path string) *Map

JsonFileToMap load json file to Map structure

func (*Util) JsonStringToMap

func (u *Util) JsonStringToMap(str string) *Map

JsonStringToMap json string to Map structure

func (*Util) Load

func (u *Util) Load(path string) []byte

Load file to byte array

func (*Util) NewMap

func (u *Util) NewMap(m map[string]interface{}) *Map

NewMap create new Map

func (*Util) NewSlice

func (u *Util) NewSlice(s []interface{}) *Slice

NewSlice create new Slice

Directories

Path Synopsis
test module

Jump to

Keyboard shortcuts

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