mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
add buildin function yamli for package gview
This commit is contained in:
@ -120,6 +120,12 @@ func (j *Json) ToYaml() ([]byte, error) {
|
||||
return gyaml.Encode(*(j.p))
|
||||
}
|
||||
|
||||
func (j *Json) ToYamlIndent(indent string) ([]byte, error) {
|
||||
j.mu.RLock()
|
||||
defer j.mu.RUnlock()
|
||||
return gyaml.EncodeIndent(*(j.p), indent)
|
||||
}
|
||||
|
||||
func (j *Json) ToYamlString() (string, error) {
|
||||
b, e := j.ToYaml()
|
||||
return string(b), e
|
||||
@ -170,8 +176,6 @@ func (j *Json) MustToTomlString() string {
|
||||
|
||||
// ToIni json to ini
|
||||
func (j *Json) ToIni() ([]byte, error) {
|
||||
j.mu.RLock()
|
||||
defer j.mu.RUnlock()
|
||||
return gini.Encode(j.Map())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user