Go API Documentation

github.com/titpetric/microservice/internal

No package summary is available.

Package

Files: 5. Third party imports: 3. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Types

Semaphore

Semaphore provides a run-once type of flag (atomic)

Field name Field type Comment
semaphore

int32

No comment on field.

ctxWithoutCancel

This type doesn't have documentation.

Field name Field type Comment

context.Context

No comment on field.

ipAddressCtxKey

This type doesn't have documentation.

Functions

func ContextWithoutCancel

ContextWithoutCancel returns a non-cancelable ctx

func GetIPFromContext

GetIPFromContext gets IP value from ctx

func NewServerHooks

NewServerHooks provides an error logging hook with Elastic APM

Uses: apm.CaptureError, context.Context, twirp.Error, twirp.ServerHooks.

func SetIPToContext

SetIPToContext sets IP value to ctx

Uses: context.WithValue.

func WrapAll

WrapAll wraps a http.Handler with all needed handlers for our service

Uses: apmhttp.Wrap.

func WrapWithIP

WrapWithIP wraps a http.Handler to inject the client IP into the context

Uses: http.CanonicalHeaderKey, http.HandlerFunc, http.Request, http.ResponseWriter, strings.SplitN.

func (*Semaphore) CanRun

CanRun will allow a caller to proceed

Uses: atomic.CompareAndSwapInt32.

func (*Semaphore) Done

Done finishes the run

Uses: atomic.CompareAndSwapInt32.

func (ctxWithoutCancel) Done

Done returns nil (not cancellable)

func (ctxWithoutCancel) Err

Err returns nil (not cancellable)