Documentation
¶
Overview ¶
Package gsjson provides structure and helper functions for JSON handling
Index ¶
- func Decode(encenv string) string
- func DecodeJsonFile(path string, passphrase []byte) (retstr string, err error)
- func DecodeJsonFileNoErr(path string, passphrase []byte) (retstr string)
- func GetDecryptedEnvValue() string
- func GetDecryptedEnvValueThenAddEnv(m map[string]string) (ejsondata string)
- func GetEncryptedEnvValue() string
- func GetEncryptedEnvValueThenAddEnv(m map[string]string) (ejsondata string)
- func GetEnvName() string
- func GetOrCreateEnv(key, defaultValue string) (retstr string)
- func Getenv(key string) (value string)
- func Hasenv(key string) bool
- func Init()
- func SetEnvFromDecryptedValue(value string)
- func Setenv(key, value string) (err error)
- func String() string
- func Unsetenv(key string) (err error)
- type Ejson
- func (gs *Ejson) Delete(path string) (err error)
- func (gs *Ejson) Get(path string) (result gjson.Result)
- func (gs *Ejson) LoadAndDelete(path string) (value gjson.Result)
- func (gs *Ejson) LoadNewData(buffer []byte) (err error)
- func (gs *Ejson) LoadOrStore(path string, value any) (actual gjson.Result)
- func (gs *Ejson) Loads() (result gjson.Result)
- func (gs *Ejson) Set(path string, value interface{}) (err error)
- func (gs *Ejson) SetHookLoad(f func(buffer *[]byte))
- func (gs *Ejson) SetRaw(path string, value []byte) (err error)
- func (gs *Ejson) String() string
- func (gs *Ejson) WriteTo(path string, password []byte) (err error)
- type EnvJson
- func (dd *EnvJson) Decode(encenv string) string
- func (dd *EnvJson) GetDecryptedEnvValue() string
- func (dd *EnvJson) GetDecryptedEnvValueThenAddEnv(m map[string]string) (ejsondata string)
- func (dd *EnvJson) GetEncryptedEnvValue() string
- func (dd *EnvJson) GetEncryptedEnvValueThenAddEnv(m map[string]string) (ejsondata string)
- func (dd *EnvJson) GetEnvName() string
- func (dd *EnvJson) GetOrCreateEnv(key, defaultValue string) (retstr string)
- func (dd *EnvJson) Getenv(key string) (value string)
- func (dd *EnvJson) Hasenv(key string) bool
- func (dd *EnvJson) SetEnvFromDecryptedValue(value string)
- func (dd *EnvJson) Setenv(key, value string) (err error)
- func (dd *EnvJson) String() string
- func (dd *EnvJson) Unsetenv(key string) (err error)
- type Fjson
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJsonFile ¶
func DecodeJsonFileNoErr ¶
func GetDecryptedEnvValue ¶
func GetDecryptedEnvValue() string
func GetEncryptedEnvValue ¶
func GetEncryptedEnvValue() string
func GetEnvName ¶
func GetEnvName() string
func GetOrCreateEnv ¶
func SetEnvFromDecryptedValue ¶
func SetEnvFromDecryptedValue(value string)
Types ¶
type Ejson ¶
var default_passphrase = []byte("default_passphrase") Ejson is a file used to store the process ID of a running process.
func (*Ejson) LoadAndDelete ¶
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func (*Ejson) LoadNewData ¶
func (*Ejson) LoadOrStore ¶
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*Ejson) SetHookLoad ¶
type EnvJson ¶
func GetGenvjson ¶
func GetGenvjson() *EnvJson
func NewEnvJson ¶
func (*EnvJson) GetDecryptedEnvValue ¶
func (*EnvJson) GetDecryptedEnvValueThenAddEnv ¶
func (*EnvJson) GetEncryptedEnvValue ¶
func (*EnvJson) GetEncryptedEnvValueThenAddEnv ¶
func (*EnvJson) GetEnvName ¶
func (*EnvJson) GetOrCreateEnv ¶
func (*EnvJson) SetEnvFromDecryptedValue ¶
type Fjson ¶
type Fjson struct {
RmdirFlag bool `json:"RmdirFlag"`
ForceInit bool
*Ejson
// contains filtered or unexported fields
}
func NewFjson ¶
func NewFjson(path string, passphrase []byte, removeIfFileInvalid bool, datas ...map[string]interface{}) (f *Fjson, err error)
New creates a Fjson file using the specified path.
func (*Fjson) GetJsonFilePath ¶
func (*Fjson) GetPassPhrase ¶
func (*Fjson) WriteToFile ¶
func (f *Fjson) WriteToFile()
Click to show internal directories.
Click to hide internal directories.