Categorygithub.com/lyf-coder/entity
modulepackage
1.2.0
Repository: https://github.com/lyf-coder/entity.git
Documentation: pkg.go.dev

# README

entity

Go json access like viper

Actions GoDoc Go Report Card

Install

go get github.com/lyf-coder/entity

Usage

import (
    "github.com/lyf-coder/entity"
)
// json string
jsonStr := `{"IP": "127.0.0.1", "admin": {"name":"jack"}}`

// json string to []byte
b := []byte(jsonStr)

// new entity
entity := entity.NewByJSON(b)

// Usage
entity.GetString("IP")  // "127.0.0.1"
entity.GetString("admin:name")  // "jack"

# Functions

New returns an initialized Entity instance.
NewByJSON returns an initialized Entity instance by json byte[].
ToStringMapSlice casts an interface to a []map[string]interface{} type.

# Structs

Entity is json access type like github.com/spf13/viper.