awesome_libs

package module
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 5 Imported by: 15

README

awesome libs

  • cipher
  • error: print and trace
  • reflect: some useful reflect gadgets
  • slice
    • func In(item interface{}, slice interface{}) bool
  • python like format

error

use awesome_libs/log.Logger as Logger
import "github.com/ssst0n3/awesome_libs/awesome_error"

func example()  {
    awesome_error.CheckError(errors.New("test"))
}
use self-defined logger
import (
	"errors"
	"github.com/ssst0n3/awesome_libs/log/logger"
	"os"
)

func example() {
	a := GetAwesomeError(logger.InitLogger("my-logger", os.Stdout))
	a.CheckErr(errors.New("apple"))
}

cipher

There's a CommonCipher already inited for you. It's key read from SecretDir/awesome_libs_cipher_common.

import "github.com/ssst0n3/awesome_libs/cipher"

func any()  {
    ...
    enc, err := cipher.CommonCipher.Encrypt(pt)
}

python like format

import "github.com/ssst0n3/awesome_libs"

func Format()  {
	awesome_libs.Format("Hello {.name}", awesome_libs.Dict{
		"name": "awesome",
	})
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(tpl string, arg Dict, delimiters ...string) string

Types

type Dict

type Dict map[string]interface{}

type NumberCompatibleBool added in v0.5.9

type NumberCompatibleBool bool

func (*NumberCompatibleBool) UnmarshalJSON added in v0.5.9

func (bit *NumberCompatibleBool) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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