utils

package
v0.0.0-...-ecde71a Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: GPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//Route - The engine of gin
	Route = gin.Default()
	// V1 version 1 group
	V1 *gin.RouterGroup
	// V2 version 2 group
	V2 *gin.RouterGroup
)

Functions

func CreaterTestForHTTP

func CreaterTestForHTTP(t *testing.T, routeURL, requestURL string, handler gin.HandlerFunc, models interface{}) int

CreaterTestForHTTP for httptest, return statusCode

func DatetimeOfDate

func DatetimeOfDate(datetime time.Time) time.Time

DatetimeOfDate -

func IsHoliday

func IsHoliday(t time.Time) bool

IsHoliday - check the day is holiday or not

func Now

func Now() time.Time

Now - time.Now() of Asia/Tokyo

func TokyoTime

func TokyoTime(datetime time.Time) time.Time

TokyoTime -

Types

type Async

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

Async -

func Executor

func Executor(c *gin.Context) Async

Executor - execute function safely for gin

func (Async) IsAborted

func (async Async) IsAborted() bool

IsAborted return context.IsAborted or response is already written

func (Async) Parallel

func (async Async) Parallel(tasks ParallelCallback)

Parallel - execute function safely for gin

func (Async) Waterfall

func (async Async) Waterfall(tasks ...func(param interface{}) (interface{}, error))

Waterfall - execute function safely for gin

type BsonCreator

type BsonCreator struct {
	Pipeline []bson.M
}

BsonCreator is a bson creator (without pointer)

func (BsonCreator) Append

func (bc BsonCreator) Append(ms ...bson.M) BsonCreator

Append the slice of bson.M

func (BsonCreator) GraphLookup

func (bc BsonCreator) GraphLookup(from, startWith, connectFromField, connectToField, as, lang string) BsonCreator

GraphLookup Performs a recursive search on a collection, with options for restricting the search by recursion depth and query filter.

func (BsonCreator) Lookup

func (bc BsonCreator) Lookup(from, localField, foreignField, as string) BsonCreator

Lookup without unwind will find a slice document (array)

func (BsonCreator) LookupWithUnwind

func (bc BsonCreator) LookupWithUnwind(from, localField, foreignField, as, lang string) BsonCreator

LookupWithUnwind will find single document, not a slice

type DrawPoint

type DrawPoint struct {
	X, Y float64
}

DrawPoint -

func (DrawPoint) Add

func (dp DrawPoint) Add(x, y float64) DrawPoint

Add returns the rectangle r translated by p.

type ParallelCallback

type ParallelCallback map[string]func() (interface{}, error)

ParallelCallback -

type PlanDraw

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

PlanDraw -

func NewPlanDraw

func NewPlanDraw(resID string, isWithBackground bool) *PlanDraw

NewPlanDraw make a draw with bacground image name

func (*PlanDraw) DrawLines

func (pd *PlanDraw) DrawLines(lines []DrawPoint) *PlanDraw

DrawLines -

func (*PlanDraw) DrawMark

func (pd *PlanDraw) DrawMark(resID string, point DrawPoint) *PlanDraw

DrawMark -

func (*PlanDraw) DrawString

func (pd *PlanDraw) DrawString(str string, point DrawPoint) *PlanDraw

DrawString -

func (*PlanDraw) SaveImage

func (pd *PlanDraw) SaveImage(filepath string)

SaveImage -

Jump to

Keyboard shortcuts

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