service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess = iota
	CodeInternalServerError
	CodeInvalidRequest
	CodeMethodNotAllowed
	CodeRequestTimeout
)
View Source
const (
	STORE_REDIS = "redis"
	STORE_GOB   = "gob"
	STORE_FILE  = "file"
	STORE_MAP   = "map"
)

Variables

View Source
var (
	KeyDelimiter = tokenize.KeyDelimiter
	ParamVarID   = "id"
)
View Source
var (
	Tokenize      = "/tokenize"
	Detokenize    = "/detokenize"
	GetTokens     = "/all"
	Introduction  = "/new"
	GetTokensByID = "/id"
	DeleteToken   = "/delete"
	PatchToken    = "/patch"
)
View Source
var (
	ErrMethodNotAllowed                = "method not allowed"
	Err404                             = "404 not found"
	ErrParameterizedVariableNotPassedF = "parameterized variable %s empty"
)
View Source
var (
	ErrInvalidRequestParameter = errors.New("invalid request parameter")
)

Functions

func DeleteTokenByIDHandler

func DeleteTokenByIDHandler(srv *Service) func(w http.ResponseWriter, r *http.Request)

func DeleteTokenByIDParamHandler

func DeleteTokenByIDParamHandler(srv *Service) func(w http.ResponseWriter, r *http.Request)

func DetokenizeHandlerFunc

func DetokenizeHandlerFunc(srv *Service) func(w http.ResponseWriter, r *http.Request)

func GetTokenByIDParamHandler

func GetTokenByIDParamHandler(srv *Service) func(w http.ResponseWriter, r *http.Request)

func GetTokensByIDHandler

func GetTokensByIDHandler(srv *Service) func(w http.ResponseWriter, r *http.Request)

func GetTokensHandler

func GetTokensHandler(srv *Service) func(w http.ResponseWriter, r *http.Request)

func PatchTokenByIDParamHandler

func PatchTokenByIDParamHandler(srv *Service) func(w http.ResponseWriter, r *http.Request)

func TokenizeHandlerFunc

func TokenizeHandlerFunc(srv *Service) func(w http.ResponseWriter, r *http.Request)

func VaultHandlerFunc

func VaultHandlerFunc(srv *Service) func(w http.ResponseWriter, r *http.Request)

Types

type Options

type Options func(*Service)

func WithFileLoc

func WithFileLoc(loc string) Options

func WithGobLoc

func WithGobLoc(loc string) Options

func WithGobTrunc

func WithGobTrunc() Options

func WithRedisConnString

func WithRedisConnString(connStr string) Options

func WithStoreStr

func WithStoreStr(storeStr string) Options

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, log *vlog.Logger, opts ...Options) (*Service, error)

func (*Service) LoadHandlers

func (s *Service) LoadHandlers(ctx context.Context)

func (*Service) Port

func (s *Service) Port() string

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

func (*Service) SetDefaults

func (s *Service) SetDefaults()

type StartConfig

type StartConfig struct {
	// contains filtered or unexported fields
}

type VaultHandler

type VaultHandler map[string]func(w http.ResponseWriter, r *http.Request)

func NewVaultHandler

func NewVaultHandler(ctx context.Context, srv *Service) *VaultHandler

Jump to

Keyboard shortcuts

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