39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
// Package abstract ...
|
|
//
|
|
// Description : abstract ...
|
|
//
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
//
|
|
// Date : 2025-05-06 10:42
|
|
package abstract
|
|
|
|
// IJsonRead json数据读取接口约束
|
|
type IJsonRead interface {
|
|
// Exist 指定路径是否存在
|
|
Exist(dataPath string) bool
|
|
// IsNil 指定路径是否为nil
|
|
IsNil(dataPath string) bool
|
|
// Type 路径数据类型
|
|
Type(dataPath string) string
|
|
// Int 转换为int类型
|
|
Int(dataPath string) (int64, error)
|
|
// Uint 转换为uint类型
|
|
Uint(dataPath string) (uint64, error)
|
|
// Float 转换为float类型
|
|
Float(dataPath string) (float64, error)
|
|
// String 转换为string类型
|
|
String(dataPath string) (string, error)
|
|
// Bool 转换为bool类型
|
|
Bool(dataPath string) (bool, error)
|
|
// Map 转换为map
|
|
Map(dataPath string) (map[string]any, error)
|
|
// MapWithReceiver 通过指针接收
|
|
MapWithReceiver(dataPath string, receiver any) error
|
|
// Array 转换为数组
|
|
Array(dataPath string) ([]any, error)
|
|
// ArrayWithReceiver 通过指针接收
|
|
ArrayWithReceiver(dataPath string, receiver any) error
|
|
// Value 自适应类型数据读取
|
|
Value(dataPath string, dataType string, defaultValue any) (any, error)
|
|
}
|