gooseneck

package module
v0.1.33 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 16 Imported by: 0

README

Gooseneck

Because trashy is better than copy and paste.

Documentation

Index

Constants

View Source
const (
	AUTHORIZATION = "Authorization"
	BEARER        = "Bearer "
	X_API_KEY     = "X-Api-Key"
)
View Source
const (
	DATABASE_URL = "DATABASE_URL"
	JWT_SECRET   = "JWT_SECRET"
	LOG_LEVEL    = "LOG_LEVEL"
	PORT         = "PORT"
	UPSTREAM     = "UPSTREAM"
)
View Source
const (
	REDIS_ADDR     = "REDIS_ADDR"
	REDIS_DATABASE = "REDIS_DATABASE"
	REDIS_PASSWORD = "REDIS_PASSWORD"
	REDIS_USERNAME = "REDIS_USERNAME"
)

Variables

View Source
var (
	Trace = log.Trace
	Debug = log.Debug
	Info  = log.Info
	Warn  = log.Warn
	Error = log.Error
	Fatal = log.Fatal
	Panic = log.Panic

	//
	Log = log.Log
)
View Source
var (
	MetricsHandler = promhttp.Handler
)
View Source
var NewCache = cache.New

Functions

func HealthCheck

func HealthCheck(w http.ResponseWriter, r *http.Request)

func InitLog

func InitLog()

func MakeCounter

func MakeCounter(namespace string, subsystem string, name string, help string, constLabels MetricLabels) prometheus.Counter

func MakeCounterFunc

func MakeCounterFunc(namespace string, subsystem string, name string, help string, constLabels MetricLabels, fn func() float64) prometheus.CounterFunc

func MakeCounterVec

func MakeCounterVec(namespace string, subsystem string, name string, help string, constLabels MetricLabels, labelNames MetricLabelNames) *prometheus.CounterVec

func MakeGauge

func MakeGauge(namespace string, subsystem string, name string, help string, constLabels MetricLabels) prometheus.Gauge

func MakeGaugeFunc

func MakeGaugeFunc(namespace string, subsystem string, name string, help string, constLabels MetricLabels, fn func() float64) prometheus.GaugeFunc

func MakeGaugeVec

func MakeGaugeVec(namespace string, subsystem string, name string, help string, constLabels MetricLabels, labelNames MetricLabelNames) *prometheus.GaugeVec

func MakeHistogram

func MakeHistogram(namespace string, subsystem string, name string, help string, constLabels MetricLabels) prometheus.Histogram

func MakeHistogramVec

func MakeHistogramVec(namespace string, subsystem string, name string, help string, constLabels MetricLabels, labelNames MetricLabelNames) *prometheus.HistogramVec

func MakeResponseFunc

func MakeResponseFunc(status int, body string) func(w http.ResponseWriter)

func MakeSummary

func MakeSummary(namespace string, subsystem string, name string, help string, constLabels MetricLabels) prometheus.Summary

func MakeSummaryVec

func MakeSummaryVec(namespace string, subsystem string, name string, help string, constLabels MetricLabels, labelNames MetricLabelNames) *prometheus.SummaryVec

func MakeUntypedFunc

func MakeUntypedFunc(namespace string, subsystem string, name string, help string, constLabels MetricLabels, fn func() float64) prometheus.UntypedFunc

func NewHttpRouter

func NewHttpRouter() *httprouter.Router

func NewRedisClient

func NewRedisClient() *redis.Client

Types

type Cache

type Cache = cache.Cache

type Database

type Database struct {
	Options *DatabaseOptions
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(options *DatabaseOptions) *Database

func (*Database) Connection

func (db *Database) Connection() *sql.DB

type DatabaseOptions

type DatabaseOptions struct {
	DSN               string
	MaxOpenConns      int
	MaxIdleConns      int
	ConnMaxLifetime   time.Duration
	ReconnectInterval time.Duration
}

type Env

type Env struct {
}

func (Env) MustDefine

func (e Env) MustDefine(key string) string

func (Env) Optional

func (e Env) Optional(key string, defaultValue string) string

func (Env) Port

func (e Env) Port() string

type MetricLabelNames

type MetricLabelNames = []string

type MetricLabels

type MetricLabels = prometheus.Labels

type RedisEnv

type RedisEnv struct {
	Env
}

func (RedisEnv) Addr

func (e RedisEnv) Addr() string

func (RedisEnv) Database

func (e RedisEnv) Database() int

func (RedisEnv) Password

func (e RedisEnv) Password() string

func (RedisEnv) Username

func (e RedisEnv) Username() string

Jump to

Keyboard shortcuts

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