mirror of
https://github.com/bakito/adguardhome-sync.git
synced 2024-11-14 20:06:08 +08:00
16 lines
291 B
Go
16 lines
291 B
Go
|
package utils
|
||
|
|
||
|
import "encoding/json"
|
||
|
|
||
|
func Clone[I interface{}](in I, out I) I {
|
||
|
b, _ := json.Marshal(in)
|
||
|
_ = json.Unmarshal(b, out)
|
||
|
return out
|
||
|
}
|
||
|
|
||
|
func JsonEquals(a interface{}, b interface{}) bool {
|
||
|
ja, _ := json.Marshal(a)
|
||
|
jb, _ := json.Marshal(b)
|
||
|
return string(ja) == string(jb)
|
||
|
}
|