Skip to content

Commit

Permalink
📝 doc: re-generate new README and fix some code style
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jan 4, 2024
1 parent 3ace818 commit 9ef6bd0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 20 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ func MaxFloat(x, y float64) float64
// source at mathutil/convert.go
func NewConvOption[T any](optFns ...ConvOptionFn[T]) *ConvOption[T]
func WithNilAsFail[T any](opt *ConvOption[T])
func WithHandlePtr[T any](opt *ConvOption[T])
func WithUserConvFn[T any](fn ToTypeFunc[T]) ConvOptionFn[T]
func Int(in any) (int, error)
func SafeInt(in any) int
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ func MaxFloat(x, y float64) float64
// source at mathutil/convert.go
func NewConvOption[T any](optFns ...ConvOptionFn[T]) *ConvOption[T]
func WithNilAsFail[T any](opt *ConvOption[T])
func WithHandlePtr[T any](opt *ConvOption[T])
func WithUserConvFn[T any](fn ToTypeFunc[T]) ConvOptionFn[T]
func Int(in any) (int, error)
func SafeInt(in any) int
Expand Down
5 changes: 4 additions & 1 deletion fsutil/opwrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,17 @@ func TempDir(dir, pattern string) (string, error) {

// MustSave create file and write contents to file, panic on error.
//
// data type allow: string, []byte, io.Reader
// - data type allow: string, []byte, io.Reader
//
// default option see NewOpenOption()
func MustSave(filePath string, data any, optFns ...OpenOptionFunc) {
basefn.MustOK(SaveFile(filePath, data, optFns...))
}

// SaveFile create file and write contents to file. will auto create dir.
//
// - data type allow: string, []byte, io.Reader
//
// default option see NewOpenOption()
func SaveFile(filePath string, data any, optFns ...OpenOptionFunc) error {
opt := NewOpenOption(optFns...)
Expand Down
3 changes: 1 addition & 2 deletions reflects/reflects.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package reflects

import (
"fmt"
"reflect"
)

Expand All @@ -12,6 +11,6 @@ var (
anyType = reflect.TypeOf((*any)(nil)).Elem()
errorType = reflect.TypeOf((*error)(nil)).Elem()

fmtStringerType = reflect.TypeOf((*fmt.Stringer)(nil)).Elem()
// fmtStringerType = reflect.TypeOf((*fmt.Stringer)(nil)).Elem()
reflectValueType = reflect.TypeOf((*reflect.Value)(nil)).Elem()
)
17 changes: 0 additions & 17 deletions strutil/strutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"strings"
"text/template"

"github.com/gookit/goutil/comdef"
)
Expand Down Expand Up @@ -90,22 +89,6 @@ func NewReplacer(pairs map[string]string) *strings.Replacer {
return strings.NewReplacer(ss...)
}

var builtInFuncs = template.FuncMap{
// don't escape content
"raw": func(s string) string {
return s
},
"trim": strings.TrimSpace,
// join strings
"join": func(ss []string, sep string) string {
return strings.Join(ss, sep)
},
// lower first char
"lcFirst": LowerFirst,
// upper first char
"upFirst": UpperFirst,
}

// WrapTag for given string.
func WrapTag(s, tag string) string {
if s == "" {
Expand Down

0 comments on commit 9ef6bd0

Please sign in to comment.