json_filter/abstract/json_read.go

33 lines
950 B
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
// Int 转换为int类型
Int(dataPath string) (int, error)
// Uint 转换为uint类型
Uint(dataPath string) (uint, error)
// Float 转换为float类型
Float(dataPath string) (float64, error)
// String 转换为string类型
String(dataPath string) (string, 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
}