-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstructs.go
More file actions
31 lines (23 loc) · 897 Bytes
/
Copy pathstructs.go
File metadata and controls
31 lines (23 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package gozod
import "github.com/kaptinlin/gozod/types"
type FromStructOption = types.FromStructOption
func WithTagName(name string) FromStructOption {
return types.WithTagName(name)
}
// WithFieldNameTag sets the struct tag used for field names (e.g. "yaml",
// "toml"). It defaults to "json".
func WithFieldNameTag(name string) FromStructOption {
return types.WithFieldNameTag(name)
}
func FromStruct[T any](opts ...FromStructOption) (*types.ZodStruct[T, T], error) {
return types.FromStruct[T](opts...)
}
func FromStructPtr[T any](opts ...FromStructOption) (*types.ZodStruct[T, *T], error) {
return types.FromStructPtr[T](opts...)
}
func MustFromStruct[T any](opts ...FromStructOption) *types.ZodStruct[T, T] {
return types.MustFromStruct[T](opts...)
}
func MustFromStructPtr[T any](opts ...FromStructOption) *types.ZodStruct[T, *T] {
return types.MustFromStructPtr[T](opts...)
}