Skip to content

Latest commit

 

History

History
90 lines (65 loc) · 1.37 KB

README.md

File metadata and controls

90 lines (65 loc) · 1.37 KB

GSR

GitHub go.mod Go version GoDoc Go Report Card

Go Standards Recommendations

Install

go get github.com/gookit/gsr

Interfaces

Usage

Logger Interface

Std Logger

package main
import (
	"github.com/gookit/gsr"
)

type MyApp struct {
	logger gsr.StdLogger // std logger
}

func (ma *MyApp) SetLogger(logger gsr.StdLogger)  {
	ma.logger = logger
}

Full Logger

package main
import (
	"github.com/gookit/gsr"
)

type MyApp struct {
	logger gsr.Logger // full logger
}

func (ma *MyApp) SetLogger(logger gsr.Logger)  {
	ma.logger = logger
}

Cache Interface

Simple Cache

package main
import (
	"github.com/gookit/gsr"
)

type MyApp struct {
	cacher gsr.SimpleCacher
}

func (ma *MyApp) SetCacher(cacher gsr.SimpleCacher)  {
	ma.cacher = cacher
}

DataParser interface

// DataParser interface for Marshal/Unmarshal data
type DataParser interface {
	Marshal(v any) ([]byte, error)
	Unmarshal(data []byte, ptr any) error
}

LICENSE

MIT