Documentation ¶
Overview ¶
Package kitgo is a set of curated golang helpers intended to ease development process, created by wrapping commonly used package and modules
Package kitgo is a generated GoMock package.
Index ¶
- Constants
- Variables
- func ListenToSignal(sigs ...os.Signal) os.Signal
- func NewErrors(errs ...error) errorList
- func PanicWhen(condition bool, v interface{})
- func Parallel(ctx context.Context, onError func(int, error), tasks ...func() error)
- func RecoverWith(catch func(recv interface{}))
- func ShouldCover(code int, required float64) int
- type AESGCM
- type Base64Wrapper
- type Brotli
- type Client
- type ConsoleWriter
- type CryptoWrapper
- func (*CryptoWrapper) Argon2I(password []byte) []byte
- func (*CryptoWrapper) Argon2ICompareHashAndPassword(hashed, password []byte) bool
- func (*CryptoWrapper) Argon2ID(password []byte) []byte
- func (*CryptoWrapper) Argon2IDCompareHashAndPassword(hashed, password []byte) bool
- func (*CryptoWrapper) BCrypt(password []byte) []byte
- func (*CryptoWrapper) BCryptCompareHashAndPassword(hashed, password []byte) bool
- func (*CryptoWrapper) NewAESGCM(password []byte) *AESGCM
- func (*CryptoWrapper) NewECDSA(curv elliptic.Curve) (*ECDSA, error)
- func (*CryptoWrapper) NewNaCl() *NaCl
- func (*CryptoWrapper) NewRSA(bits int) (*RSA, error)
- func (*CryptoWrapper) NewTLSConfig(certFile, keyFile, dirCache string, hostWhitelist ...string) *tls.Config
- func (*CryptoWrapper) Nonce(length int) []byte
- func (*CryptoWrapper) ReadECDSA(key, pub io.Reader) (*ECDSA, error)
- func (*CryptoWrapper) ReadRSA(key, pub io.Reader) (*RSA, error)
- func (*CryptoWrapper) SCrypt(password []byte) []byte
- func (*CryptoWrapper) SCryptCompareHashAndPassword(hashed, password []byte) bool
- func (*CryptoWrapper) SHA256(b []byte) []byte
- func (*CryptoWrapper) SHA512(b []byte) []byte
- type Currency
- type Dict
- type DirConfig
- type DirWrapper
- type ECDSA
- type FilterFunc
- type Flate
- type FsFileInfo
- type GraphicsConfig
- type GraphicsWrapper
- func (x *GraphicsWrapper) Blur(dst io.Writer, src io.Reader, stdDev float64, size int) (err error)
- func (x *GraphicsWrapper) Decode(src io.Reader) (img image.Image, format string, err error)
- func (x *GraphicsWrapper) DecodeConfig(src io.Reader) (conf image.Config, format string, err error)
- func (x *GraphicsWrapper) Encode(dst io.Writer, img image.Image, format string) (err error)
- func (x *GraphicsWrapper) Rect(x0, y0, x1, y1 int) image.Rectangle
- func (x *GraphicsWrapper) Rotate(dst io.Writer, src io.Reader, angle float64) (err error)
- func (x *GraphicsWrapper) Scale(dst io.Writer, src io.Reader, w, h int) (err error)
- func (x *GraphicsWrapper) SubImage(img image.Image, rect image.Rectangle) (sub image.Image)
- func (x *GraphicsWrapper) Thumbnail(dst io.Writer, src io.Reader, w, h int) (err error)
- type Gzip
- type HTMLTemplateWrapper
- type HTTPClientMock
- type HTTPClientTrace
- type HTTPClientWrapper
- type HTTPMux
- type HTTPMuxMatcher
- type HTTPReverseProxy
- type HTTPServerWrapper
- type HTTPTransportWrapper
- func (x HTTPTransportWrapper) DumpOnRequest(dst io.Writer, includeBody bool) HTTPTransportWrapper
- func (x HTTPTransportWrapper) DumpOnResponse(dst io.Writer, includeBody bool) HTTPTransportWrapper
- func (x HTTPTransportWrapper) OnRequest(v func(*http.Request) error) HTTPTransportWrapper
- func (x HTTPTransportWrapper) OnResponse(v func(*http.Response) error) HTTPTransportWrapper
- func (x HTTPTransportWrapper) RoundTrip(req *http.Request) (res *http.Response, err error)
- func (x HTTPTransportWrapper) WithBase(v http.RoundTripper) HTTPTransportWrapper
- func (x HTTPTransportWrapper) WithTrace(v *HTTPClientTrace) HTTPTransportWrapper
- type List
- type LogConfig
- type LogWrapper
- type Minify
- type MockFsFileInfo
- func (m *MockFsFileInfo) EXPECT() *MockFsFileInfoMockRecorder
- func (m *MockFsFileInfo) IsDir() bool
- func (m *MockFsFileInfo) ModTime() time.Time
- func (m *MockFsFileInfo) Mode() fs.FileMode
- func (m *MockFsFileInfo) Name() string
- func (m *MockFsFileInfo) Size() int64
- func (m *MockFsFileInfo) Sys() interface{}
- type MockFsFileInfoMockRecorder
- func (mr *MockFsFileInfoMockRecorder) IsDir() *gomock.Call
- func (mr *MockFsFileInfoMockRecorder) ModTime() *gomock.Call
- func (mr *MockFsFileInfoMockRecorder) Mode() *gomock.Call
- func (mr *MockFsFileInfoMockRecorder) Name() *gomock.Call
- func (mr *MockFsFileInfoMockRecorder) Size() *gomock.Call
- func (mr *MockFsFileInfoMockRecorder) Sys() *gomock.Call
- type MockNetAddr
- type MockNetAddrMockRecorder
- type MockNetConn
- func (m *MockNetConn) Close() error
- func (m *MockNetConn) EXPECT() *MockNetConnMockRecorder
- func (m *MockNetConn) LocalAddr() net.Addr
- func (m *MockNetConn) Read(b []byte) (int, error)
- func (m *MockNetConn) RemoteAddr() net.Addr
- func (m *MockNetConn) SetDeadline(t time.Time) error
- func (m *MockNetConn) SetReadDeadline(t time.Time) error
- func (m *MockNetConn) SetWriteDeadline(t time.Time) error
- func (m *MockNetConn) Write(b []byte) (int, error)
- type MockNetConnMockRecorder
- func (mr *MockNetConnMockRecorder) Close() *gomock.Call
- func (mr *MockNetConnMockRecorder) LocalAddr() *gomock.Call
- func (mr *MockNetConnMockRecorder) Read(b interface{}) *gomock.Call
- func (mr *MockNetConnMockRecorder) RemoteAddr() *gomock.Call
- func (mr *MockNetConnMockRecorder) SetDeadline(t interface{}) *gomock.Call
- func (mr *MockNetConnMockRecorder) SetReadDeadline(t interface{}) *gomock.Call
- func (mr *MockNetConnMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call
- func (mr *MockNetConnMockRecorder) Write(b interface{}) *gomock.Call
- type MockNetDialer
- type MockNetDialerMockRecorder
- type MockNetResolver
- func (m *MockNetResolver) EXPECT() *MockNetResolverMockRecorder
- func (m *MockNetResolver) LookupAddr(ctx context.Context, addr string) ([]string, error)
- func (m *MockNetResolver) LookupCNAME(ctx context.Context, host string) (string, error)
- func (m *MockNetResolver) LookupHost(ctx context.Context, host string) ([]string, error)
- func (m *MockNetResolver) LookupIP(ctx context.Context, network, host string) ([]net.IP, error)
- func (m *MockNetResolver) LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)
- func (m *MockNetResolver) LookupMX(ctx context.Context, name string) ([]*net.MX, error)
- func (m *MockNetResolver) LookupNS(ctx context.Context, name string) ([]*net.NS, error)
- func (m *MockNetResolver) LookupPort(ctx context.Context, network, service string) (int, error)
- func (m *MockNetResolver) LookupSRV(ctx context.Context, service, proto, name string) (string, []*net.SRV, error)
- func (m *MockNetResolver) LookupTXT(ctx context.Context, name string) ([]string, error)
- type MockNetResolverMockRecorder
- func (mr *MockNetResolverMockRecorder) LookupAddr(ctx, addr interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupCNAME(ctx, host interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupHost(ctx, host interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupIP(ctx, network, host interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupIPAddr(ctx, host interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupMX(ctx, name interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupNS(ctx, name interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupPort(ctx, network, service interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupSRV(ctx, service, proto, name interface{}) *gomock.Call
- func (mr *MockNetResolverMockRecorder) LookupTXT(ctx, name interface{}) *gomock.Call
- type MockSmtpClient
- func (m *MockSmtpClient) Auth(a smtp.Auth) error
- func (m *MockSmtpClient) Close() error
- func (m *MockSmtpClient) Data() (io.WriteCloser, error)
- func (m *MockSmtpClient) EXPECT() *MockSmtpClientMockRecorder
- func (m *MockSmtpClient) Extension(ext string) (bool, string)
- func (m *MockSmtpClient) Hello(localName string) error
- func (m *MockSmtpClient) Mail(from string) error
- func (m *MockSmtpClient) Noop() error
- func (m *MockSmtpClient) Quit() error
- func (m *MockSmtpClient) Rcpt(to string) error
- func (m *MockSmtpClient) Reset() error
- func (m *MockSmtpClient) StartTLS(config *tls.Config) error
- func (m *MockSmtpClient) TLSConnectionState() (tls.ConnectionState, bool)
- func (m *MockSmtpClient) Verify(addr string) error
- type MockSmtpClientMockRecorder
- func (mr *MockSmtpClientMockRecorder) Auth(a interface{}) *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Close() *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Data() *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Extension(ext interface{}) *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Hello(localName interface{}) *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Mail(from interface{}) *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Noop() *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Quit() *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Rcpt(to interface{}) *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Reset() *gomock.Call
- func (mr *MockSmtpClientMockRecorder) StartTLS(config interface{}) *gomock.Call
- func (mr *MockSmtpClientMockRecorder) TLSConnectionState() *gomock.Call
- func (mr *MockSmtpClientMockRecorder) Verify(addr interface{}) *gomock.Call
- type NaCl
- func (*NaCl) AuthSum(message []byte, secretKey *[32]byte) []byte
- func (*NaCl) AuthVerify(digest []byte, message []byte, secretKey *[32]byte) bool
- func (*NaCl) BoxKeyPair() (publicKey, privateKey *[32]byte, err error)
- func (*NaCl) BoxOpen(box_ []byte, peersPublicKey, privateKey *[32]byte) ([]byte, bool)
- func (*NaCl) BoxOpenAfterPrecomputation(box_ []byte, sharedKey *[32]byte) ([]byte, bool)
- func (*NaCl) BoxOpenAnonymous(box_ []byte, publicKey, privateKey *[32]byte) (message []byte, ok bool)
- func (*NaCl) BoxPrecompute(peersPublicKey, privateKey *[32]byte) (sharedKey *[32]byte)
- func (*NaCl) BoxSeal(message []byte, peersPublicKey, privateKey *[32]byte) []byte
- func (*NaCl) BoxSealAfterPrecomputation(message []byte, sharedKey *[32]byte) []byte
- func (*NaCl) BoxSealAnonymous(message []byte, recipient *[32]byte) ([]byte, error)
- func (*NaCl) SecretBoxOpen(box_ []byte, key *[32]byte) ([]byte, bool)
- func (*NaCl) SecretBoxSeal(message []byte, key *[32]byte) []byte
- func (*NaCl) Sign(message []byte, privateKey *[64]byte) []byte
- func (*NaCl) SignKeyPair() (publicKey *[32]byte, privateKey *[64]byte, err error)
- func (*NaCl) SignOpen(signedMessage []byte, publicKey *[32]byte) ([]byte, bool)
- type NetAddr
- type NetConn
- type NetDialer
- type NetResolver
- type NetSMTPMock
- type NetSMTPWrapper
- type PrometheusConfig
- type PrometheusMock
- func (p *PrometheusMock) CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames ...string) error
- func (p *PrometheusMock) CollectAndCount(c prometheus.Collector, metricNames ...string) int
- func (p *PrometheusMock) CollectAndLint(c prometheus.Collector, metricNames ...string) ([]promlint.Problem, error)
- func (p *PrometheusMock) ToFloat64(c prometheus.Collector) float64
- type PrometheusWrapper
- func (p *PrometheusWrapper) CounterVec(name, help string, labelNames ...string) *prometheus.CounterVec
- func (p *PrometheusWrapper) GaugeVec(name, help string, labelNames ...string) *prometheus.GaugeVec
- func (p *PrometheusWrapper) HistogramVec(name, help string, labelNames ...string) *prometheus.HistogramVec
- func (p *PrometheusWrapper) SummaryVec(name, help string, labelNames ...string) *prometheus.SummaryVec
- type RSA
- func (x *RSA) DecryptOAEP(ciphertext, label []byte) ([]byte, error)
- func (x *RSA) DecryptPKCS1v15(ciphertext []byte) ([]byte, error)
- func (x *RSA) EncryptOAEP(msg, label []byte) ([]byte, error)
- func (x *RSA) EncryptPKCS1v15(msg []byte) ([]byte, error)
- func (x *RSA) Write(key, pub io.Writer) (err error)
- type RedisConfig
- type RedisMock
- type RedisWrapper
- type RistrettoCacheI
- type RistrettoCacheMetricsI
- type RistrettoConfig
- type RistrettoWrapper
- type SMTPConfig
- type SQLConfig
- type SQLMock
- type SQLResultExec
- type SQLResultQuery
- type SQLResultQueryRow
- type SQLStatement
- func (s SQLStatement) Exec(ctx context.Context, args ...interface{}) (res SQLResultExec, err error)
- func (s SQLStatement) Query(ctx context.Context, args ...interface{}) (rows SQLResultQuery, err error)
- func (s SQLStatement) QueryRow(ctx context.Context, args ...interface{}) (row SQLResultQueryRow, err error)
- type SQLWrapper
- type SmtpClient
- type TextTemplateWrapper
Constants ¶
const ( AcceptEncoding = "Accept-Encoding" ContentType = "Content-Type" ContentEncoding = "Content-Encoding" XContentTypeOptions = "X-Content-Type-Options" )
Variables ¶
var Base64 = base64_{}
var Compress compress_
var Crypto crypto_
var Dir dir_
var Graphics graphics_
var HTTP http_
var JSON jsoniter.API = jsoniter.ConfigFastest
JSON is a jsoniter.API with ConfigFastest, satisfied encoding/json package
var Log log_
var Prometheus prometheus_
var Redis redis_
Redis implement a wrapper around "go-redis/redis"
var Ristretto ristretto_
var SMTP smtp_
SMTP implement a wrapper around standard "html/template" so that the SMTP is limited to Parse & Execute
var SQL sql_
SQL implement a wrapper around standard "database/sql" and extend it to be able to support Statement and Done
var Template template
Functions ¶
func ListenToSignal ¶
ListenToSignal will block until receiving signal from input
func PanicWhen ¶
func PanicWhen(condition bool, v interface{})
PanicWhen execute a panic when condition is met and v is not nil
func Parallel ¶
Parallel receive cancelable context and receiving error channel along with list of tasks, a func() error that will execute in asynchronous manners
if receiving error channel is unbuffered, it will block the current execution process, would be better if receiving error channel is buffered with len(tasks)
context is also cancelable and this is to run in go routine
func RecoverWith ¶
func RecoverWith(catch func(recv interface{}))
RecoverWith will catch error value passed when panic
Types ¶
type Base64Wrapper ¶ added in v0.0.2
type Base64Wrapper struct {
// contains filtered or unexported fields
}
func (Base64Wrapper) AtoB ¶ added in v0.0.2
func (x Base64Wrapper) AtoB(b []byte) []byte
func (Base64Wrapper) BtoA ¶ added in v0.0.2
func (x Base64Wrapper) BtoA(b []byte) []byte
type Brotli ¶ added in v0.0.2
type Brotli struct {
// contains filtered or unexported fields
}
type ConsoleWriter ¶ added in v0.0.2
type ConsoleWriter = zerolog.ConsoleWriter
type CryptoWrapper ¶ added in v0.0.2
type CryptoWrapper struct{}
func (*CryptoWrapper) Argon2I ¶ added in v0.0.2
func (*CryptoWrapper) Argon2I(password []byte) []byte
func (*CryptoWrapper) Argon2ICompareHashAndPassword ¶ added in v0.0.2
func (*CryptoWrapper) Argon2ICompareHashAndPassword(hashed, password []byte) bool
func (*CryptoWrapper) Argon2ID ¶ added in v0.0.2
func (*CryptoWrapper) Argon2ID(password []byte) []byte
func (*CryptoWrapper) Argon2IDCompareHashAndPassword ¶ added in v0.0.2
func (*CryptoWrapper) Argon2IDCompareHashAndPassword(hashed, password []byte) bool
func (*CryptoWrapper) BCrypt ¶ added in v0.0.2
func (*CryptoWrapper) BCrypt(password []byte) []byte
func (*CryptoWrapper) BCryptCompareHashAndPassword ¶ added in v0.0.2
func (*CryptoWrapper) BCryptCompareHashAndPassword(hashed, password []byte) bool
func (*CryptoWrapper) NewAESGCM ¶ added in v0.0.2
func (*CryptoWrapper) NewAESGCM(password []byte) *AESGCM
func (*CryptoWrapper) NewECDSA ¶ added in v0.0.2
func (*CryptoWrapper) NewECDSA(curv elliptic.Curve) (*ECDSA, error)
func (*CryptoWrapper) NewNaCl ¶ added in v0.0.2
func (*CryptoWrapper) NewNaCl() *NaCl
func (*CryptoWrapper) NewTLSConfig ¶ added in v0.0.2
func (*CryptoWrapper) NewTLSConfig(certFile, keyFile, dirCache string, hostWhitelist ...string) *tls.Config
func (*CryptoWrapper) Nonce ¶ added in v0.0.2
func (*CryptoWrapper) Nonce(length int) []byte
func (*CryptoWrapper) ReadECDSA ¶ added in v0.0.2
func (*CryptoWrapper) ReadECDSA(key, pub io.Reader) (*ECDSA, error)
func (*CryptoWrapper) ReadRSA ¶ added in v0.0.2
func (*CryptoWrapper) ReadRSA(key, pub io.Reader) (*RSA, error)
func (*CryptoWrapper) SCrypt ¶ added in v0.0.2
func (*CryptoWrapper) SCrypt(password []byte) []byte
func (*CryptoWrapper) SCryptCompareHashAndPassword ¶ added in v0.0.2
func (*CryptoWrapper) SCryptCompareHashAndPassword(hashed, password []byte) bool
func (*CryptoWrapper) SHA256 ¶ added in v0.0.2
func (*CryptoWrapper) SHA256(b []byte) []byte
func (*CryptoWrapper) SHA512 ¶ added in v0.0.2
func (*CryptoWrapper) SHA512(b []byte) []byte
type Currency ¶
type Currency struct { // Tag parse according to BCP47 string Tag string // Value contains the value of currency Value float64 // Format default to "%[1]s %[2]s" means currency sign, followed by value // %[1]s is a currency sign by language // %[2]s is a parsed Value // // According to each format, e.g. Format string }
Currency immutable struct contains price & its format
func (Currency) MarshalJSON ¶
MarshalJSON implement json marshaler
type Dict ¶
type Dict map[string]interface{}
Dict extends `map[string]interface{}`, and it should be used to represent json-like data
type DirWrapper ¶ added in v0.0.2
type DirWrapper struct {
// contains filtered or unexported fields
}
func (*DirWrapper) Dirs ¶ added in v0.0.2
func (x *DirWrapper) Dirs() []*DirWrapper
func (*DirWrapper) Files ¶ added in v0.0.2
func (x *DirWrapper) Files() []*os.File
func (*DirWrapper) FilesInfo ¶ added in v0.0.2
func (x *DirWrapper) FilesInfo() []os.FileInfo
func (*DirWrapper) Filter ¶ added in v0.0.2
func (x *DirWrapper) Filter(filter FilterFunc) *DirWrapper
func (*DirWrapper) Walk ¶ added in v0.0.2
func (x *DirWrapper) Walk(next string) *DirWrapper
type ECDSA ¶ added in v0.0.2
type ECDSA struct{ *ecdsa.PrivateKey }
func (*ECDSA) VerifyASN1 ¶ added in v0.0.2
type FsFileInfo ¶
type GraphicsConfig ¶ added in v0.0.2
type GraphicsWrapper ¶ added in v0.0.2
type GraphicsWrapper struct {
// contains filtered or unexported fields
}
func (*GraphicsWrapper) DecodeConfig ¶ added in v0.0.2
func (*GraphicsWrapper) Rect ¶ added in v0.0.2
func (x *GraphicsWrapper) Rect(x0, y0, x1, y1 int) image.Rectangle
type HTMLTemplateWrapper ¶ added in v0.0.2
type HTMLTemplateWrapper struct {
// contains filtered or unexported fields
}
func (*HTMLTemplateWrapper) Execute ¶ added in v0.0.2
func (x *HTMLTemplateWrapper) Execute(w io.Writer, key string, data interface{}) error
Execute receive a key as string and data (the easiest is using map[string]interface{}) key is usually a `define` keyword in your template
{{define "index"}} <html>{{.content}}</html> {{end}}
to set `.content`, send map[string]interface{}{ "content": "hello, world" }
note that set html need to convert to template.HTML, use the helper in `internal/datatype`
to set `.content`, send map[string]interface{}{ "content": datatype.HTML("<div>hello</div> <div>world</div>") }
type HTTPClientMock ¶ added in v0.0.2
func (*HTTPClientMock) Expect ¶ added in v0.0.2
func (x *HTTPClientMock) Expect(method, pattern string, handler http.Handler)
func (x *HTTPClientMock) NewRequest(method, target string, body io.Reader) *http.Request { return httptest.NewRequest(method, target, body) }
func (*HTTPClientMock) URL ¶ added in v0.0.2
func (x *HTTPClientMock) URL(path string) string
type HTTPClientTrace ¶ added in v0.0.2
type HTTPClientTrace = httptrace.ClientTrace
type HTTPClientWrapper ¶ added in v0.0.2
type HTTPMux ¶ added in v0.0.2
type HTTPMux struct { // PanicHandler can access the error recovered via PanicRecoveryFromRequest, // PanicRecoveryFromRequest is a helper under httphandler package PanicHandler http.Handler NotFoundHandler http.Handler // contains filtered or unexported fields }
HTTPMux holds a map of entries
func (*HTTPMux) GoString ¶ added in v0.0.2
GoString is useful for inspection by listing all its properties, also called when encountering verb %#v in fmt.fmt.Printf
func (*HTTPMux) Handle ¶ added in v0.0.2
Handle will register http.Handler with MuxMatcherMethods on method and MuxMatcherPattern on pattern, see more details on each mux matcher implementation
type HTTPMuxMatcher ¶ added in v0.0.2
type HTTPMuxMatcher interface { // Test is called when MuxMatcher is added to Mux, this should be an // opportunity to set priority and test the implementation parameter // e.g. MuxMatcherPattern should check pattern, start, end Test() bool // Priority is called after Test() returning true to set a priority queue Priority() float64 // Match is called by order of Priority, after its turn, it will validate // *http.Request and if the result is true, the http.Handler registered // in the entry will be served Match(*http.Request) bool // fmt.GoStringer is useful inspection methods, e.g. comparing parameter // or priority fmt.GoStringer // json.Marshaler and json.Unmarshaler should be supported too, in order to // build the MuxMatcher based on config json.Marshaler }
HTTPMuxMatcher is an incoming *http.Request matcher
type HTTPReverseProxy ¶ added in v0.0.2
type HTTPReverseProxy = httputil.ReverseProxy
type HTTPServerWrapper ¶ added in v0.0.2
type HTTPTransportWrapper ¶ added in v0.0.2
type HTTPTransportWrapper struct {
// contains filtered or unexported fields
}
HTTPTransportWrapper implement http.RoundTripper, with 3 useful fields
- Trace (*httptrace.ClientTrace) one can use `HTTPTrace` directly an modify its fields
- RequestFn callback when creating *http.Request
- ResponseFn callback when receiving *http.Response
func (HTTPTransportWrapper) DumpOnRequest ¶ added in v0.0.2
func (x HTTPTransportWrapper) DumpOnRequest(dst io.Writer, includeBody bool) HTTPTransportWrapper
func (HTTPTransportWrapper) DumpOnResponse ¶ added in v0.0.2
func (x HTTPTransportWrapper) DumpOnResponse(dst io.Writer, includeBody bool) HTTPTransportWrapper
func (HTTPTransportWrapper) OnRequest ¶ added in v0.0.2
func (x HTTPTransportWrapper) OnRequest(v func(*http.Request) error) HTTPTransportWrapper
func (HTTPTransportWrapper) OnResponse ¶ added in v0.0.2
func (x HTTPTransportWrapper) OnResponse(v func(*http.Response) error) HTTPTransportWrapper
func (HTTPTransportWrapper) WithBase ¶ added in v0.0.2
func (x HTTPTransportWrapper) WithBase(v http.RoundTripper) HTTPTransportWrapper
func (HTTPTransportWrapper) WithTrace ¶ added in v0.0.2
func (x HTTPTransportWrapper) WithTrace(v *HTTPClientTrace) HTTPTransportWrapper
type List ¶
type List []interface{}
List extends `[]interface{}`, and it should be used to represent json-like data
type LogConfig ¶ added in v0.0.2
func (*LogConfig) ConsoleWriter ¶ added in v0.0.2
func (c *LogConfig) ConsoleWriter(cw *ConsoleWriter) *LogConfig
type LogWrapper ¶ added in v0.0.2
type LogWrapper struct { // Logger is a default *log.Logger instance *log.Logger // contains filtered or unexported fields }
LogWrapper implement all the methods of *log.Logger also accessible from .Logger
LogWrapper also have extension via .Z to access more robust logging experience using zerolog
func (*LogWrapper) UseErrorStackMarshaler ¶ added in v0.0.2
func (x *LogWrapper) UseErrorStackMarshaler(use bool) *LogWrapper
type Minify ¶ added in v0.0.2
type Minify struct {
// contains filtered or unexported fields
}
func (*Minify) WithMediaType ¶ added in v0.0.2
type MockFsFileInfo ¶
type MockFsFileInfo struct {
// contains filtered or unexported fields
}
MockFsFileInfo is a mock of FsFileInfo interface.
func NewMockFsFileInfo ¶
func NewMockFsFileInfo(ctrl *gomock.Controller) *MockFsFileInfo
NewMockFsFileInfo creates a new mock instance.
func (*MockFsFileInfo) EXPECT ¶
func (m *MockFsFileInfo) EXPECT() *MockFsFileInfoMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockFsFileInfo) ModTime ¶
func (m *MockFsFileInfo) ModTime() time.Time
ModTime mocks base method.
type MockFsFileInfoMockRecorder ¶
type MockFsFileInfoMockRecorder struct {
// contains filtered or unexported fields
}
MockFsFileInfoMockRecorder is the mock recorder for MockFsFileInfo.
func (*MockFsFileInfoMockRecorder) IsDir ¶
func (mr *MockFsFileInfoMockRecorder) IsDir() *gomock.Call
IsDir indicates an expected call of IsDir.
func (*MockFsFileInfoMockRecorder) ModTime ¶
func (mr *MockFsFileInfoMockRecorder) ModTime() *gomock.Call
ModTime indicates an expected call of ModTime.
func (*MockFsFileInfoMockRecorder) Mode ¶
func (mr *MockFsFileInfoMockRecorder) Mode() *gomock.Call
Mode indicates an expected call of Mode.
func (*MockFsFileInfoMockRecorder) Name ¶
func (mr *MockFsFileInfoMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockFsFileInfoMockRecorder) Size ¶
func (mr *MockFsFileInfoMockRecorder) Size() *gomock.Call
Size indicates an expected call of Size.
func (*MockFsFileInfoMockRecorder) Sys ¶
func (mr *MockFsFileInfoMockRecorder) Sys() *gomock.Call
Sys indicates an expected call of Sys.
type MockNetAddr ¶
type MockNetAddr struct {
// contains filtered or unexported fields
}
MockNetAddr is a mock of NetAddr interface.
func NewMockNetAddr ¶
func NewMockNetAddr(ctrl *gomock.Controller) *MockNetAddr
NewMockNetAddr creates a new mock instance.
func (*MockNetAddr) EXPECT ¶
func (m *MockNetAddr) EXPECT() *MockNetAddrMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockNetAddrMockRecorder ¶
type MockNetAddrMockRecorder struct {
// contains filtered or unexported fields
}
MockNetAddrMockRecorder is the mock recorder for MockNetAddr.
func (*MockNetAddrMockRecorder) Network ¶
func (mr *MockNetAddrMockRecorder) Network() *gomock.Call
Network indicates an expected call of Network.
func (*MockNetAddrMockRecorder) String ¶
func (mr *MockNetAddrMockRecorder) String() *gomock.Call
String indicates an expected call of String.
type MockNetConn ¶
type MockNetConn struct {
// contains filtered or unexported fields
}
MockNetConn is a mock of NetConn interface.
func NewMockNetConn ¶
func NewMockNetConn(ctrl *gomock.Controller) *MockNetConn
NewMockNetConn creates a new mock instance.
func (*MockNetConn) EXPECT ¶
func (m *MockNetConn) EXPECT() *MockNetConnMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockNetConn) LocalAddr ¶
func (m *MockNetConn) LocalAddr() net.Addr
LocalAddr mocks base method.
func (*MockNetConn) Read ¶
func (m *MockNetConn) Read(b []byte) (int, error)
Read mocks base method.
func (*MockNetConn) RemoteAddr ¶
func (m *MockNetConn) RemoteAddr() net.Addr
RemoteAddr mocks base method.
func (*MockNetConn) SetDeadline ¶
func (m *MockNetConn) SetDeadline(t time.Time) error
SetDeadline mocks base method.
func (*MockNetConn) SetReadDeadline ¶
func (m *MockNetConn) SetReadDeadline(t time.Time) error
SetReadDeadline mocks base method.
func (*MockNetConn) SetWriteDeadline ¶
func (m *MockNetConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline mocks base method.
type MockNetConnMockRecorder ¶
type MockNetConnMockRecorder struct {
// contains filtered or unexported fields
}
MockNetConnMockRecorder is the mock recorder for MockNetConn.
func (*MockNetConnMockRecorder) Close ¶
func (mr *MockNetConnMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockNetConnMockRecorder) LocalAddr ¶
func (mr *MockNetConnMockRecorder) LocalAddr() *gomock.Call
LocalAddr indicates an expected call of LocalAddr.
func (*MockNetConnMockRecorder) Read ¶
func (mr *MockNetConnMockRecorder) Read(b interface{}) *gomock.Call
Read indicates an expected call of Read.
func (*MockNetConnMockRecorder) RemoteAddr ¶
func (mr *MockNetConnMockRecorder) RemoteAddr() *gomock.Call
RemoteAddr indicates an expected call of RemoteAddr.
func (*MockNetConnMockRecorder) SetDeadline ¶
func (mr *MockNetConnMockRecorder) SetDeadline(t interface{}) *gomock.Call
SetDeadline indicates an expected call of SetDeadline.
func (*MockNetConnMockRecorder) SetReadDeadline ¶
func (mr *MockNetConnMockRecorder) SetReadDeadline(t interface{}) *gomock.Call
SetReadDeadline indicates an expected call of SetReadDeadline.
func (*MockNetConnMockRecorder) SetWriteDeadline ¶
func (mr *MockNetConnMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call
SetWriteDeadline indicates an expected call of SetWriteDeadline.
func (*MockNetConnMockRecorder) Write ¶
func (mr *MockNetConnMockRecorder) Write(b interface{}) *gomock.Call
Write indicates an expected call of Write.
type MockNetDialer ¶
type MockNetDialer struct {
// contains filtered or unexported fields
}
MockNetDialer is a mock of NetDialer interface.
func NewMockNetDialer ¶
func NewMockNetDialer(ctrl *gomock.Controller) *MockNetDialer
NewMockNetDialer creates a new mock instance.
func (*MockNetDialer) Dial ¶
func (m *MockNetDialer) Dial(network, address string) (net.Conn, error)
Dial mocks base method.
func (*MockNetDialer) DialContext ¶
DialContext mocks base method.
func (*MockNetDialer) EXPECT ¶
func (m *MockNetDialer) EXPECT() *MockNetDialerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockNetDialerMockRecorder ¶
type MockNetDialerMockRecorder struct {
// contains filtered or unexported fields
}
MockNetDialerMockRecorder is the mock recorder for MockNetDialer.
func (*MockNetDialerMockRecorder) Dial ¶
func (mr *MockNetDialerMockRecorder) Dial(network, address interface{}) *gomock.Call
Dial indicates an expected call of Dial.
func (*MockNetDialerMockRecorder) DialContext ¶
func (mr *MockNetDialerMockRecorder) DialContext(ctx, network, address interface{}) *gomock.Call
DialContext indicates an expected call of DialContext.
type MockNetResolver ¶
type MockNetResolver struct {
// contains filtered or unexported fields
}
MockNetResolver is a mock of NetResolver interface.
func NewMockNetResolver ¶
func NewMockNetResolver(ctrl *gomock.Controller) *MockNetResolver
NewMockNetResolver creates a new mock instance.
func (*MockNetResolver) EXPECT ¶
func (m *MockNetResolver) EXPECT() *MockNetResolverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockNetResolver) LookupAddr ¶
LookupAddr mocks base method.
func (*MockNetResolver) LookupCNAME ¶
LookupCNAME mocks base method.
func (*MockNetResolver) LookupHost ¶
LookupHost mocks base method.
func (*MockNetResolver) LookupIPAddr ¶
LookupIPAddr mocks base method.
func (*MockNetResolver) LookupPort ¶
LookupPort mocks base method.
type MockNetResolverMockRecorder ¶
type MockNetResolverMockRecorder struct {
// contains filtered or unexported fields
}
MockNetResolverMockRecorder is the mock recorder for MockNetResolver.
func (*MockNetResolverMockRecorder) LookupAddr ¶
func (mr *MockNetResolverMockRecorder) LookupAddr(ctx, addr interface{}) *gomock.Call
LookupAddr indicates an expected call of LookupAddr.
func (*MockNetResolverMockRecorder) LookupCNAME ¶
func (mr *MockNetResolverMockRecorder) LookupCNAME(ctx, host interface{}) *gomock.Call
LookupCNAME indicates an expected call of LookupCNAME.
func (*MockNetResolverMockRecorder) LookupHost ¶
func (mr *MockNetResolverMockRecorder) LookupHost(ctx, host interface{}) *gomock.Call
LookupHost indicates an expected call of LookupHost.
func (*MockNetResolverMockRecorder) LookupIP ¶
func (mr *MockNetResolverMockRecorder) LookupIP(ctx, network, host interface{}) *gomock.Call
LookupIP indicates an expected call of LookupIP.
func (*MockNetResolverMockRecorder) LookupIPAddr ¶
func (mr *MockNetResolverMockRecorder) LookupIPAddr(ctx, host interface{}) *gomock.Call
LookupIPAddr indicates an expected call of LookupIPAddr.
func (*MockNetResolverMockRecorder) LookupMX ¶
func (mr *MockNetResolverMockRecorder) LookupMX(ctx, name interface{}) *gomock.Call
LookupMX indicates an expected call of LookupMX.
func (*MockNetResolverMockRecorder) LookupNS ¶
func (mr *MockNetResolverMockRecorder) LookupNS(ctx, name interface{}) *gomock.Call
LookupNS indicates an expected call of LookupNS.
func (*MockNetResolverMockRecorder) LookupPort ¶
func (mr *MockNetResolverMockRecorder) LookupPort(ctx, network, service interface{}) *gomock.Call
LookupPort indicates an expected call of LookupPort.
func (*MockNetResolverMockRecorder) LookupSRV ¶
func (mr *MockNetResolverMockRecorder) LookupSRV(ctx, service, proto, name interface{}) *gomock.Call
LookupSRV indicates an expected call of LookupSRV.
func (*MockNetResolverMockRecorder) LookupTXT ¶
func (mr *MockNetResolverMockRecorder) LookupTXT(ctx, name interface{}) *gomock.Call
LookupTXT indicates an expected call of LookupTXT.
type MockSmtpClient ¶
type MockSmtpClient struct {
// contains filtered or unexported fields
}
MockSmtpClient is a mock of SmtpClient interface.
func NewMockSmtpClient ¶
func NewMockSmtpClient(ctrl *gomock.Controller) *MockSmtpClient
NewMockSmtpClient creates a new mock instance.
func (*MockSmtpClient) Auth ¶
func (m *MockSmtpClient) Auth(a smtp.Auth) error
Auth mocks base method.
func (*MockSmtpClient) Data ¶
func (m *MockSmtpClient) Data() (io.WriteCloser, error)
Data mocks base method.
func (*MockSmtpClient) EXPECT ¶
func (m *MockSmtpClient) EXPECT() *MockSmtpClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSmtpClient) Extension ¶
func (m *MockSmtpClient) Extension(ext string) (bool, string)
Extension mocks base method.
func (*MockSmtpClient) Hello ¶
func (m *MockSmtpClient) Hello(localName string) error
Hello mocks base method.
func (*MockSmtpClient) Mail ¶
func (m *MockSmtpClient) Mail(from string) error
Mail mocks base method.
func (*MockSmtpClient) Rcpt ¶
func (m *MockSmtpClient) Rcpt(to string) error
Rcpt mocks base method.
func (*MockSmtpClient) StartTLS ¶
func (m *MockSmtpClient) StartTLS(config *tls.Config) error
StartTLS mocks base method.
func (*MockSmtpClient) TLSConnectionState ¶
func (m *MockSmtpClient) TLSConnectionState() (tls.ConnectionState, bool)
TLSConnectionState mocks base method.
func (*MockSmtpClient) Verify ¶
func (m *MockSmtpClient) Verify(addr string) error
Verify mocks base method.
type MockSmtpClientMockRecorder ¶
type MockSmtpClientMockRecorder struct {
// contains filtered or unexported fields
}
MockSmtpClientMockRecorder is the mock recorder for MockSmtpClient.
func (*MockSmtpClientMockRecorder) Auth ¶
func (mr *MockSmtpClientMockRecorder) Auth(a interface{}) *gomock.Call
Auth indicates an expected call of Auth.
func (*MockSmtpClientMockRecorder) Close ¶
func (mr *MockSmtpClientMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockSmtpClientMockRecorder) Data ¶
func (mr *MockSmtpClientMockRecorder) Data() *gomock.Call
Data indicates an expected call of Data.
func (*MockSmtpClientMockRecorder) Extension ¶
func (mr *MockSmtpClientMockRecorder) Extension(ext interface{}) *gomock.Call
Extension indicates an expected call of Extension.
func (*MockSmtpClientMockRecorder) Hello ¶
func (mr *MockSmtpClientMockRecorder) Hello(localName interface{}) *gomock.Call
Hello indicates an expected call of Hello.
func (*MockSmtpClientMockRecorder) Mail ¶
func (mr *MockSmtpClientMockRecorder) Mail(from interface{}) *gomock.Call
Mail indicates an expected call of Mail.
func (*MockSmtpClientMockRecorder) Noop ¶
func (mr *MockSmtpClientMockRecorder) Noop() *gomock.Call
Noop indicates an expected call of Noop.
func (*MockSmtpClientMockRecorder) Quit ¶
func (mr *MockSmtpClientMockRecorder) Quit() *gomock.Call
Quit indicates an expected call of Quit.
func (*MockSmtpClientMockRecorder) Rcpt ¶
func (mr *MockSmtpClientMockRecorder) Rcpt(to interface{}) *gomock.Call
Rcpt indicates an expected call of Rcpt.
func (*MockSmtpClientMockRecorder) Reset ¶
func (mr *MockSmtpClientMockRecorder) Reset() *gomock.Call
Reset indicates an expected call of Reset.
func (*MockSmtpClientMockRecorder) StartTLS ¶
func (mr *MockSmtpClientMockRecorder) StartTLS(config interface{}) *gomock.Call
StartTLS indicates an expected call of StartTLS.
func (*MockSmtpClientMockRecorder) TLSConnectionState ¶
func (mr *MockSmtpClientMockRecorder) TLSConnectionState() *gomock.Call
TLSConnectionState indicates an expected call of TLSConnectionState.
func (*MockSmtpClientMockRecorder) Verify ¶
func (mr *MockSmtpClientMockRecorder) Verify(addr interface{}) *gomock.Call
Verify indicates an expected call of Verify.
type NaCl ¶ added in v0.0.2
type NaCl struct{}
func (*NaCl) AuthVerify ¶ added in v0.0.2
func (*NaCl) BoxKeyPair ¶ added in v0.0.2
func (*NaCl) BoxOpenAfterPrecomputation ¶ added in v0.0.2
func (*NaCl) BoxOpenAnonymous ¶ added in v0.0.2
func (*NaCl) BoxPrecompute ¶ added in v0.0.2
func (*NaCl) BoxSealAfterPrecomputation ¶ added in v0.0.2
func (*NaCl) BoxSealAnonymous ¶ added in v0.0.2
func (*NaCl) SecretBoxOpen ¶ added in v0.0.2
func (*NaCl) SecretBoxSeal ¶ added in v0.0.2
func (*NaCl) SignKeyPair ¶ added in v0.0.2
type NetResolver ¶
type NetResolver interface { LookupHost(ctx context.Context, host string) (addrs []string, err error) LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error) LookupIP(ctx context.Context, network, host string) ([]net.IP, error) LookupPort(ctx context.Context, network, service string) (port int, err error) LookupCNAME(ctx context.Context, host string) (cname string, err error) LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) LookupMX(ctx context.Context, name string) ([]*net.MX, error) LookupNS(ctx context.Context, name string) ([]*net.NS, error) LookupTXT(ctx context.Context, name string) ([]string, error) LookupAddr(ctx context.Context, addr string) (names []string, err error) }
type NetSMTPMock ¶ added in v0.0.2
type NetSMTPMock struct {
// contains filtered or unexported fields
}
func (*NetSMTPMock) WithNetDialer ¶ added in v0.0.2
func (x *NetSMTPMock) WithNetDialer(netDialer NetDialer)
func (*NetSMTPMock) WithNetResolver ¶ added in v0.0.2
func (x *NetSMTPMock) WithNetResolver(netResolver NetResolver)
func (*NetSMTPMock) WithNewSmtpClient ¶ added in v0.0.2
func (x *NetSMTPMock) WithNewSmtpClient(client SmtpClient, err error)
func (*NetSMTPMock) WithSendMail ¶ added in v0.0.2
func (x *NetSMTPMock) WithSendMail(err error)
type NetSMTPWrapper ¶ added in v0.0.2
type NetSMTPWrapper struct {
// contains filtered or unexported fields
}
func (*NetSMTPWrapper) ReverseLookup ¶ added in v0.0.2
type PrometheusConfig ¶ added in v0.0.2
type PrometheusMock ¶ added in v0.0.2
type PrometheusMock struct{}
func (*PrometheusMock) CollectAndCompare ¶ added in v0.0.2
func (p *PrometheusMock) CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames ...string) error
func (*PrometheusMock) CollectAndCount ¶ added in v0.0.2
func (p *PrometheusMock) CollectAndCount(c prometheus.Collector, metricNames ...string) int
func (*PrometheusMock) CollectAndLint ¶ added in v0.0.2
func (p *PrometheusMock) CollectAndLint(c prometheus.Collector, metricNames ...string) ([]promlint.Problem, error)
func (*PrometheusMock) ToFloat64 ¶ added in v0.0.2
func (p *PrometheusMock) ToFloat64(c prometheus.Collector) float64
type PrometheusWrapper ¶ added in v0.0.2
type PrometheusWrapper struct {
// contains filtered or unexported fields
}
func (*PrometheusWrapper) CounterVec ¶ added in v0.0.2
func (p *PrometheusWrapper) CounterVec(name, help string, labelNames ...string) *prometheus.CounterVec
func (*PrometheusWrapper) GaugeVec ¶ added in v0.0.2
func (p *PrometheusWrapper) GaugeVec(name, help string, labelNames ...string) *prometheus.GaugeVec
func (*PrometheusWrapper) HistogramVec ¶ added in v0.0.2
func (p *PrometheusWrapper) HistogramVec(name, help string, labelNames ...string) *prometheus.HistogramVec
func (*PrometheusWrapper) SummaryVec ¶ added in v0.0.2
func (p *PrometheusWrapper) SummaryVec(name, help string, labelNames ...string) *prometheus.SummaryVec
type RSA ¶ added in v0.0.2
type RSA struct{ *rsa.PrivateKey }
func (*RSA) DecryptOAEP ¶ added in v0.0.2
func (*RSA) DecryptPKCS1v15 ¶ added in v0.0.2
func (*RSA) EncryptOAEP ¶ added in v0.0.2
func (*RSA) EncryptPKCS1v15 ¶ added in v0.0.2
type RedisConfig ¶ added in v0.0.2
type RedisConfig = redis.UniversalOptions
type RedisWrapper ¶ added in v0.0.2
type RedisWrapper struct{ redis.UniversalClient }
type RistrettoCacheI ¶ added in v0.0.2
type RistrettoCacheMetricsI ¶ added in v0.0.2
type RistrettoConfig ¶ added in v0.0.2
type RistrettoWrapper ¶ added in v0.0.2
type SMTPConfig ¶ added in v0.0.2
type SQLMock ¶ added in v0.0.2
type SQLMock struct{ sqlmock.Sqlmock }
type SQLResultExec ¶ added in v0.0.2
type SQLResultQuery ¶ added in v0.0.2
type SQLResultQuery []Dict
type SQLResultQueryRow ¶ added in v0.0.2
type SQLResultQueryRow Dict
type SQLStatement ¶ added in v0.0.2
type SQLStatement struct {
// contains filtered or unexported fields
}
func (SQLStatement) Exec ¶ added in v0.0.2
func (s SQLStatement) Exec(ctx context.Context, args ...interface{}) (res SQLResultExec, err error)
Exec
func (SQLStatement) Query ¶ added in v0.0.2
func (s SQLStatement) Query(ctx context.Context, args ...interface{}) (rows SQLResultQuery, err error)
Query
func (SQLStatement) QueryRow ¶ added in v0.0.2
func (s SQLStatement) QueryRow(ctx context.Context, args ...interface{}) (row SQLResultQueryRow, err error)
QueryRow
type SQLWrapper ¶ added in v0.0.2
func (*SQLWrapper) Done ¶ added in v0.0.2
func (s *SQLWrapper) Done(tx *sql.Tx, err error) error
Done should validate any tx transaction with it's err, should the err is empty then do the Commit, if any err occured then do the Rollback
func (*SQLWrapper) Statement ¶ added in v0.0.2
func (s *SQLWrapper) Statement(ctx context.Context, tx *sql.Tx, q string) SQLStatement
Statement will cached a prepared statement on next identical query
type SmtpClient ¶
type SmtpClient interface { Close() error Hello(localName string) error StartTLS(config *tls.Config) error TLSConnectionState() (state tls.ConnectionState, ok bool) Verify(addr string) error Auth(a smtp.Auth) error Mail(from string) error Rcpt(to string) error Data() (io.WriteCloser, error) Extension(ext string) (bool, string) Reset() error Noop() error Quit() error }
type TextTemplateWrapper ¶ added in v0.0.2
type TextTemplateWrapper struct {
// contains filtered or unexported fields
}
func (*TextTemplateWrapper) Execute ¶ added in v0.0.2
func (x *TextTemplateWrapper) Execute(w io.Writer, key string, data interface{}) error
Execute receive a key as string and data (the easiest is using map[string]interface{}) key is usually a `define` keyword in your template
{{define "index"}} <html>{{.content}}</html> {{end}}
to set `.content`, send map[string]interface{}{ "content": "hello, world" }
note that set html need to convert to template.HTML, use the helper in `internal/datatype`
to set `.content`, send map[string]interface{}{ "content": datatype.HTML("<div>hello</div> <div>world</div>") }