sandarbha

package module
v0.0.0-...-08b7744 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: MIT Imports: 6 Imported by: 0

README

Sandarbha

Detached package from Arisanlogic

Package sandarbha is thin wrapper for context.

Comes from word sandarbha, means context in Nepali. It will make pass request-scoped values, cancellation signals, and deadlines across API boundaries to all the goroutines involved in handling a request, easier

Install

`go get -u -v github.com/kakilangit/sandarbha`

Dependencies

  • go get -u -v github.com/satori/go.uuid
  • go get -u -v github.com/stretchr/testify

Documentation

Overview

Package sandarbha is thin wrapper for context.

Comes from word sandarbha, means context in Nepali. It will make pass request-scoped values, cancelation signals, and deadlines across API boundaries to all the goroutines involved in handling a request, easier

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRequestID

func GenerateRequestID(name string) string

GenerateRequestID ...

func HTTPDo

func HTTPDo(ctx context.Context, req *http.Request, f func(*http.Response, error) error) error

HTTPDo issues the HTTP request and calls f with the response. If ctx.Done is closed while the request or f is running, HTTPDo cancels the request, waits for f to exit, and returns ctx.Err. Otherwise, HTTPDo returns f's error.

func New

func New(timeout int, ctx1 context.Context) (ctx context.Context, cancel context.CancelFunc)

New will generate context per request

func RequestID

func RequestID(ctx context.Context) string

RequestID ...

func SetCtxRequestID

func SetCtxRequestID(ctx context.Context, reqID string) context.Context

SetCtxRequestID ...

func ULID

func ULID() string

ULID generator

func UUID

func UUID() string

UUID generator

Types

This section is empty.

Jump to

Keyboard shortcuts

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