datalib

package
v0.0.0-...-aa4210d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TypeJson     = "application/json"
	TypeMsgpack  = "application/msgpack"
	TypeXMsgpack = "application/x-msgpack"
	TypeProtobuf = "application/protobuf"
)

Variables

This section is empty.

Functions

func Convert

func Convert[T any, F any](from *F) (T, error)

func ConvertType

func ConvertType[T interface{}](all []interface{}) ([]T, error)

func Copy

func Copy[T any, F any](to *T, from *F) error

func DecodeDataURI

func DecodeDataURI(uri string) (data []byte, ct string, err error)

func DefaultIfEmpty

func DefaultIfEmpty[T any](val *T, def T) *T

func EncodeDataURI

func EncodeDataURI(data []byte, contentType string) string

func IsEmpty

func IsEmpty(val interface{}) bool

func MapKeys

func MapKeys[K comparable, V any](m map[K]V) []K

func MapSlice

func MapSlice[T any, R any](s []T, f func(T) R) []R

func MapToSlice

func MapToSlice[K comparable, V any, R any](m map[K]V, f func(K, V) R) []R

func MapValues

func MapValues[K comparable, V any](m map[K]V) []V

func MarshalBody

func MarshalBody[T any](typ string, data *T) (reqBytes []byte, err error)

func NewSet

func NewSet[T comparable]() mapset.Set[T]

func ReduceSlice

func ReduceSlice[T any, R any](s []T, res R, f func(R, T) R) R

func SafeDirName

func SafeDirName(parts ...string) (fn string, err error)

func SafeFileName

func SafeFileName(filename string, ext ...string) (fn string, err error)

func UnmarshalBody

func UnmarshalBody[R any](typ string, resBody []byte) (data R, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL