Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

alibaba-archive/gear-partial-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gear-partial-response

Build Status Coverage Status

Partial response middleware for Gear.

Installation

go get -u github.com/teambition/gear-partial-response

Documentation

API documentation can be found here: https://godoc.org/github.com/teambition/gear-partial-response

Usage

import (
	"github.com/teambition/gear"
	partial "github.com/teambition/gear-partial-response"
)

When initializing the gear application:

app := gear.New()
app.Set(gear.SetSender, partial.New(partial.Options{Query: "fields"}))

In controller function:

app.Use(func(ctx *gear.Context) error {
	// ...
	return ctx.Send(http.StatusOK, data)
})