goutils

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ANY = iota
	GET
	POST
)

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(key string, def string) string

func GetEnvOrPanic added in v0.0.4

func GetEnvOrPanic(key string) string

func RandomHex

func RandomHex(size int) (string, error)

Types

type EchoRoute added in v0.0.3

type EchoRoute[T any] struct {
	Method int
	Path   string
	F      func(*T) EchoRouteFunc
}

func (EchoRoute[T]) Set added in v0.0.3

func (er EchoRoute[T]) Set(e *echo.Group, param *T)

type EchoRouteFunc added in v0.0.3

type EchoRouteFunc = func(c echo.Context) error

type File added in v0.0.5

type File[T any] struct {
	*os.File
	FileMarshal[T]
	FileUnmarshal[T]
}

func OpenBytesFile added in v0.0.5

func OpenBytesFile(path string) (*File[[]byte], error)

func OpenFile added in v0.0.5

func OpenFile[T any](path string, marshal FileMarshal[T], unmarshal FileUnmarshal[T]) (*File[T], error)

func OpenIntFile added in v0.0.5

func OpenIntFile(path string) (*File[int], error)

func OpenStringFile added in v0.0.5

func OpenStringFile(path string) (*File[string], error)

func (*File[T]) Close added in v0.0.5

func (f *File[T]) Close() error

func (*File[T]) Restore added in v0.0.5

func (f *File[T]) Restore() (*T, error)

func (*File[T]) Store added in v0.0.5

func (f *File[T]) Store(data *T) error

type FileMarshal added in v0.0.5

type FileMarshal[T any] func(*T) ([]byte, error)

type FileUnmarshal added in v0.0.5

type FileUnmarshal[T any] func([]byte) (*T, error)

Jump to

Keyboard shortcuts

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