mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 12:52:28 +08:00
refactor: remove struct_internal.go
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
package structs
|
package structs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/duke-git/lancet/v2/pointer"
|
"github.com/duke-git/lancet/v2/pointer"
|
||||||
@@ -61,7 +62,7 @@ func New(value any, tagName ...string) *Struct {
|
|||||||
// ToMap convert the exported fields of a struct to map.
|
// ToMap convert the exported fields of a struct to map.
|
||||||
func (s *Struct) ToMap() (map[string]any, error) {
|
func (s *Struct) ToMap() (map[string]any, error) {
|
||||||
if !s.IsStruct() {
|
if !s.IsStruct() {
|
||||||
return nil, errInvalidStruct(s)
|
return nil, fmt.Errorf("invalid struct %v", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
result := make(map[string]any)
|
result := make(map[string]any)
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package structs
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
func errInvalidStruct(v any) error {
|
|
||||||
return fmt.Errorf("invalid struct %v", v)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user