Commit Graph

310 Commits

Author SHA1 Message Date
Dang Nguyen
688eb1281c update examples link in README (#1789) 2019-03-02 16:04:21 +08:00
田欧
0feaf8cbd8
Split examples to alone repo (#1776)
* split examples to alone repo

* vendor

* fix package error

* add examples/README.md
2019-03-01 23:42:41 +08:00
Olivier Robardet
a58a2f9bf3 Add a function to force color in console output (#1724)
Add a function `ForceConsoleColor`, like `DisableConsoleColor` but to force coloring the output.

It usefull when some IDE's integrated console (like IntelliJ or Goland) are not detected as TTY, but can display colors.

Also helps if one want to output color in log file (#1590) and as a workaround for #1547.
2019-02-20 21:14:16 +08:00
ffhelicopter
90587c7787 Update: examples/graceful-shutdown/server.go (#1530)
* Update server.go

It's necessary that  catching  ctx.Done()

* Update server.go

* Update server.go

* Update README.md

* Update README.md
2019-02-20 13:24:29 +08:00
awkj
5846ceba8b add notify accept signal (#1740)
* add notify accept signal

* add import

* update readme,keep same with example
2019-02-20 00:02:37 +08:00
Ryan
f38a3fe65f fix password error (#1728) 2019-01-20 18:27:04 +08:00
Ganlv
1542eff27f Fix #1693: file.Filename should not be trusted (#1699) 2018-12-17 08:13:07 +08:00
Sai
f76ccb25f1 Add LoggerWithFormatter method (#1677)
* Add LoggerWithFormatter

* Add tests for LoggerWithFormatter & LoggerWithConfig

* Add note for README

* Add tests for DefaultLogFormatter

* Add comment

* Change DefaultLogFormatter to a private method
2018-12-12 09:05:16 +08:00
thinkerou
687d8b9ac6 add picfit to gin user list (#1661)
agreed with the project's author.
cc @thoas
thanks!
2018-11-25 20:52:46 +08:00
thinkerou
331af2219c add krakend to gin user list (#1658) 2018-11-24 13:49:26 +01:00
thinkerou
521d06c81d support bind uri param (#1612)
* support bind uri (1)

* uri binding successful run

* fix vet warning: github.com/gin-gonic/gin/internal.Param composite literal uses unkeyed fields

* fix code style

* update function name

* fix test function signature

* add test for CanSet

* update readme and add test case

* remove internal.Params

* add coverage

* fix warning
2018-11-22 09:29:48 +08:00
Gordon Tyler
8cb390f8fe Yaml binding (#1618)
* Add YAML binding for application/x-yaml.

* Add YAML binding methods to Context.

* Review fixes.

* Revert accidentally removed import.
2018-11-06 09:49:45 +08:00
chenyang929
b524e29442 Update README.md (#1620)
Missing the right colon
2018-11-01 22:44:49 +08:00
Barnabus
6f7fe487b3 Change HTML input tags to use HTML5 syntax. (#1617)
In XHTML, the <input> tag must be properly closed, like this `<input />`.  In HTML5 the `<input>` tag has no ending slash.  https://www.w3schools.com/tags/tag_input.asp
2018-11-01 16:05:40 +08:00
forging2012
8e9619767c FIX r.LoadHTMLGlob("/path/to/templates") (#1616)
FIX r.LoadHTMLGlob("/path/to/templates")) to r.LoadHTMLGlob("/path/to/templates")
2018-10-31 20:19:58 +08:00
田欧
a1a32562de
add gin user - photoprism (#1601) 2018-10-19 11:06:23 +08:00
A. F
333bac5f94 add example to set and get cookies (#1599) 2018-10-17 15:40:57 +08:00
zesani
fbdcbd2275 Update README.md (#1583)
change "hava" to "have"
2018-10-09 07:14:21 +08:00
田欧
5a75dc7127
add release badge for readme (#1533) 2018-09-22 11:37:28 +08:00
Jérôme Laforge
90c680ef5c Let's user define how he wants to log his routes (eg. JSON, key value, or something else) (#1553) (#1555) 2018-09-17 12:09:34 +08:00
田欧
d510595aa5 chore: add some annotations (#1544)
ref: #1075 
because I am not a native English, maybe have a bit problem.
2018-09-15 10:23:32 +08:00
Javier Provecho Fernandez
500ebd9ea8
docs: add fnproject to gin's user list (#1505) 2018-08-31 22:38:16 +02:00
llgoer
708b76adf0 Update README.md (#1509)
change  `ShouldBindXML` to `ShouldBindJSON`
2018-08-30 14:29:26 +08:00
anoty
0da5b0c85a format readme code import (#1503) 2018-08-21 13:29:25 +08:00
Filip Figiel
c6110f970c Add PureJSON renderer (#694)
Closes #693
2018-08-20 15:15:31 +08:00
aljun
efdd3c8b81 Add support for Protobuf format response and unit test (#1479)
`Gin` now have the `protobufBinding` function to check the request format, but didn't have a protobuf response function like `c.YAML()`.
In our company [ByteDance](http://bytedance.com/), the largest internet company using golang in China, we use `gin` to transfer __Protobuf__  instead of __Json__, we have to write some internal library to make some wrappers to achieve that, and the code is not elegant. So we really want such a feature.
2018-08-19 10:45:56 +08:00
chainhelen
f856aa85cd Update readme about the version of gin (#1494) 2018-08-17 14:59:55 +08:00
David Zhang
f5451bd645 Fix typo in README [ci skip] (#1492) 2018-08-17 11:33:23 +08:00
Eason Lin
a643d20605 readme: fix users link (#1493) 2018-08-17 11:21:14 +08:00
syssam
40ab9de4b5 Add BindXML AND ShouldBindXML #1484 (#1485)
Add BindXML AND ShouldBindXML #1484
2018-08-17 09:12:15 +08:00
Abner Chen
64a4548642 Fix typo in readme (#1490) 2018-08-15 13:42:12 +08:00
Alex
8aef947f6e docs: remove double negative in README.md (#1480)
"not match neither" means that it will match.
2018-08-12 22:54:22 +02:00
田欧
6159213462 unify test data (#1417)
mkdir a test data dir.
2018-08-12 23:38:31 +08:00
田欧
9666ba6738 chore: update top bar header (#1461) 2018-08-07 13:49:31 +08:00
田欧
647535cd9b Support map as query string or post form parameters (#1383)
* support query map

* add GetQueryMap and unittest

* support post-form map

* add readme for query map

* attempt to fix bug for post-form map when go version is 1.6

* remove duplicate code

* remove comment
2018-08-06 12:07:11 +08:00
Rex Lee(李俊)
85221af84c add json ASCII string render (#1358)
add a json render that rendering json as ASCII string
2018-07-03 17:17:08 +08:00
田欧
c00f21ff23 add go version prerequisite and debug warning (#1394)
* add go version prerequisite and debug warning

* merge duplicate content

* remove duplicate content
2018-06-26 18:56:43 +08:00
htobenothing
bf85b32c1d Add Pusher() function for support http2 server push (#1273)
gin already support http2, while previously not support server push.
Add Pusher() function to extend the ResponseWriter interface.

```golang
// get http.Pusher
 if pusher := c.Writer.Pusher(); pusher != nil {
     // use pusher.Push() to do server push
}
```
<img width="881" alt="screen shot 2018-03-07 at 11 20 49 pm" src="https://user-images.githubusercontent.com/16014993/37100619-680c00c6-225e-11e8-9352-76ec3bd62894.png">
2018-06-21 09:53:52 +08:00
田欧
caf3e350a5 doc: update readme for adding binding about skip validate (#1359)
* update readme for adding binding about skip validate

* update readme for adding binding about skip validate
2018-05-31 14:13:40 +08:00
chainhelen
07cbe116a0 Add and fix the explanation of HandleContext (#1371)
Reference this issue #1323 

1. There isn't any eg about `HandleContext`  
2. The `c.Request.Path`  of `HandleContext` Comment  is not right   

Based on the above two points, I pull this request.  
If you think it's unnecessary, I will close this.  
Thx.
2018-05-30 09:19:04 +08:00
Jean-Christophe Lebreton
bf7803815b Serve easily dynamic files with DataFromReader context method (#1304)
* Add DataFromReader context method

* Replace fmt by strconv.FormatInt

* Add pull request link to README
2018-05-12 11:00:42 +08:00
JINNOUCHI Yasushi
995fa8e9ce Fix #216: Enable to call binding multiple times in some formats (#1341)
* Add interface to read body bytes in binding

* Add BindingBody implementation for some binding

* Fix to use `BindBodyBytesKey` for key

* Revert "Fix to use `BindBodyBytesKey` for key"

This reverts commit 2c82901ceab6ae53730a3cfcd9839bee11a08f13.

* Use private-like key for body bytes

* Add tests for BindingBody & ShouldBindBodyWith

* Add note for README

* Remove redundant space between sentences
2018-05-11 10:33:33 +08:00
田欧
bd4f73af67 support struct pointer (#1342)
* support struct pointer

* add readme
2018-05-01 14:24:18 +08:00
senhtry
8c24018290 Add Jsonp Support to Context (#1333) 2018-04-26 11:52:19 +08:00
JINNOUCHI Yasushi
814ac9490a Add example to build single binary with templates (#1328) 2018-04-22 15:04:38 +08:00
田欧
248c522e4a Add Contents for README because it too long (#1325) 2018-04-20 09:54:00 +08:00
Suhas Karanth
6d913fc343 fix(binding): Expose validator engine used by the default Validator (#1277)
* fix(binding): Expose validator engine used by the default Validator

- Add func ValidatorEngine for returning the underlying validator engine used
  in the default StructValidator implementation.
- Remove the function RegisterValidation from the StructValidator interface
  which made it immpossible to use a StructValidator implementation without the
  validator.v8 library.
- Update and rename test for registering validation
  Test{RegisterValidation => ValidatorEngine}.
- Update readme and example for registering custom validation.
- Add example for registering struct level validation.
- Add documentation for the following binding funcs/types:
  - Binding interface
  - StructValidator interface
  - Validator instance
  - Binding implementations
  - Default func

* fix(binding): Move validator engine getter inside interface

* docs: rm date cmd from custom validation demo
2018-03-29 14:33:07 +08:00
Romain Beuque
3e3f9bca81 doc(graceful-shutdown): failure to ListenAndServe should be a reason to exit (#1287)
Signed-off-by: Romain Beuque <romain.beuque@gmail.com>
2018-03-20 14:05:24 +08:00
README Bot
cbb1ee80b1 Add CodeTriage badge to gin-gonic/gin (#1249)
Adds a badge showing the number of people helping this repo on CodeTriage.

[![Open Source Helpers](https://www.codetriage.com/gin-gonic/gin/badges/users.svg)](https://www.codetriage.com/gin-gonic/gin)

## What is CodeTriage?

CodeTriage is an Open Source app that is designed to make contributing to Open Source projects easier. It works by sending subscribers a few open issues in their inbox. If subscribers get busy, there is an algorithm that backs off issue load so they do not get overwhelmed

[Read more about the CodeTriage project](https://www.codetriage.com/what).

## Why am I getting this PR?

Your project was picked by the human, @schneems. They selected it from the projects submitted to https://www.codetriage.com and hand edited the PR. How did your project get added to [CodeTriage](https://www.codetriage.com/what)? Roughly 6 months ago, [dinsaw](https://github.com/dinsaw) added this project to CodeTriage in order to start contributing. Since then, 5 people have subscribed to help this repo.

## What does adding a badge accomplish?

Adding a badge invites people to help contribute to your project. It also lets developers know that others are invested in the longterm success and maintainability of the project.

You can see an example of a CodeTriage badge on these popular OSS READMEs:

- [![](https://www.codetriage.com/rails/rails/badges/users.svg)](https://www.codetriage.com/rails/rails) https://github.com/rails/rails
- [![](https://www.codetriage.com/crystal-lang/crystal/badges/users.svg)](https://www.codetriage.com/crystal-lang/crystal) https://github.com/crystal-lang/crystal

## Have a question or comment?

While I am a bot, this PR was manually reviewed and monitored by a human - @schneems. My job is writing commit messages and handling PR logistics.

If you have any questions, you can reply back to this PR and they will be answered by @schneems. If you do not want a badge right now, no worries, close the PR, you will not hear from me again.

Thanks for making your project Open Source! Any feedback is greatly appreciated.
2018-02-22 21:28:50 +08:00
MW Lim
7a9a290b36 minor typo in README.md (#1219) 2018-01-23 10:36:36 +08:00
Kevin Zhu
8a6792d516 Fix README.md example code (#1231)
r -> router
2018-01-23 10:07:33 +08:00
Levi Olson
05547037e4 Minor grammatical correction in README (#1206) 2017-12-21 10:48:11 +08:00
TaeJun Park
25e7cd75ed Update README.md (#1188)
change path from '~/go/...' to '$GOPATH/...'
2017-12-17 08:05:30 +08:00
Max Hilbrunner
13a40fcd2c README: Small update to clarify on Goroutines (#1199) 2017-12-17 00:52:07 +08:00
Boris Borshevsky
6f94fd05c9 Linting and optimizing struct memory signature. (#1184)
* fix cleanPath spell (#969)

* linter and optimize structs
2017-11-29 10:50:14 +08:00
Richard Lee
ae9f03e6e8 Fix up syntax error in README (#1155) 2017-11-11 23:56:59 -06:00
Andrii Bubis
80f691159f Added simple testing documentation and examples (#1156) 2017-11-11 23:37:32 -06:00
田欧
9ae1e5db2a add package for govendor (#1166)
* add package for govendor

* fix vet error.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* add missing example.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update gin-gonic/autotls

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-11-11 23:11:22 -06:00
田欧
6653d5d588 fix markdown render (#1149) 2017-10-29 21:38:38 -05:00
Suhas Karanth
dfb68ce085 feat(context): ShouldBind counterparts for Bind methods (#1047)
* feat(context): ShouldBind counterparts for Bind methods + tests

* docs(readme): Switch examples to use ShouldBind methods

Add section for bind methods types, explain difference in behavior.
Switch all `c.Bind` examples to use `c.ShouldBind`.
2017-10-23 11:14:09 +02:00
Bo-Yi Wu
b8b68314fa feat: add multiple service example. (#1119) 2017-09-29 16:48:10 +08:00
Kristoffer A. Iversen
8c17c680d9 Fixed README.md typo (#1104)
* Fixed README.md typo

* Fixed example typo

* Fixed example typo
2017-09-11 22:17:26 +08:00
Daniel M. Lambea
c9b344118f Moved const 'defaultMemory' to attrib. Engine.MaxMultipartMemory instead. (#1100) 2017-09-07 11:45:16 +08:00
Suhas Karanth
26c3f42095 feat(binding): add support for custom validator / validation tags (#1068)
* feat(binding): Add support for custom validation tags

* docs: Add example for custom validation tag

* test(binding): Add test for registering custom validation
2017-08-27 09:37:39 +02:00
stackerzzq
bc538849eb Update readme for adding tag example of binding time field (#1080) 2017-08-24 20:06:13 -05:00
Eason Lin
80152ac82c doc(readme): update writing logs section wording. (#1074)
* doc(readme): update writing logs section wording.

* doc(readme): update writing logs section wording.

* doc(readme): fix word formatting
2017-08-23 21:50:31 -05:00
田欧
8be30bd382 Update readme for showing output log to file (#1073)
* Update readme for showing output log to file

* update indent
2017-08-22 13:55:32 +08:00
Eason Lin
3856206bd0 doc(readme): add additional middleware doc. (#1056) 2017-08-17 12:18:50 +08:00
田欧
d39ed41ab3 update template example (#1038)
* update template example

* add template example folder
2017-07-20 21:29:23 -05:00
Eason Lin
c19aa0598b feat(context): add BindQuery func (#1029)
* feat(context): add BindQuery func, only parse/bind the query string params.

* docs(readme): add BindQuery section.

* docs(readme): fix import.

* docs(readme): separate import
2017-07-19 09:50:05 +02:00
Bo-Yi Wu
74221b8a35 docs(benchmark): update benchmark data (#1035)
* feat(Benchmark): update benchmark data

* fix format.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* docs(benchmarks): re indent column, feature gin

* docs(benchmark): fix newline on vm details

* docs(readme): beautify bench table, explain result
2017-07-19 09:40:05 +02:00
Bo-Yi Wu
ce670a6497 refactor(json): make jsonite optional with build tags (#1026)
* refactor(json): Restore gin support for app engine

Create new folder to support multiple json package.
restore gin support for app engine (disable jsonite through tags)

use jsoniter

$ go build -tags=jsoniter .

use default json

$ go build .

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* rename json file.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* docs(json): add build tags document.

* fix(docs): markdown format.

* fix(json): missing space.
2017-07-18 23:01:29 +02:00
Eason Lin
30cfa590bb dos(upload): fix alignment (#1030) 2017-07-17 20:23:10 -05:00
Javier Provecho Fernandez
8678b3df96 docs(readme): add reference to validator.v8 docs, close #738 (#1024) 2017-07-16 19:50:45 -05:00
Eason Lin
93b3a0d7ec feat(context): add SaveUploadedFile func. (#1022)
* feat(context): add SaveUploadedFile func.

* feat(context): update multiple upload examples.

* style(example): fix gofmt

* fix(example): add missing return
2017-07-15 22:42:08 -05:00
Eason Lin
5cb25a6410 docs(readme): fix multiple file example (#1018) 2017-07-14 12:28:16 -05:00
Javier Provecho Fernandez
fe4d405108 docs(readme): fix single file example (#1017)
issue discovered by @sgon00 at gitter
2017-07-14 11:52:16 -05:00
Javier Provecho Fernandez
df3b79e805 docs(readme): add binding html checkbox example, close #129 (#994) 2017-07-09 11:02:44 +02:00
Eason Lin
bf9758ca05 Add SecureJSON doc 2017-07-09 01:54:43 +08:00
Eason Lin
b060a5f409 docs(readme): fix code link (#989) 2017-07-08 03:16:59 -05:00
Javier Provecho Fernandez
0c3726b206 docs(readme): remove logo, relink it to gin-gonic/logo 2017-07-07 09:21:44 +02:00
Javier Provecho Fernandez
7387ef60be docs(readme): add badge for projects who use gin 2017-07-06 08:53:48 +02:00
Javier Provecho Fernandez
ff5788bfdd docs(readme): upload full size logo 2017-07-06 08:41:27 +02:00
Javier Provecho Fernandez
e4fd80c627 docs(readme): add sections to template docs 2017-07-05 16:22:58 +02:00
田欧
22fc0284e3 update readme (#976) 2017-07-04 21:42:56 -05:00
Bo-Yi Wu
f0b54a3023 fix: update autotls example. (#965) 2017-07-03 00:55:21 -05:00
Javier Provecho Fernandez
de1fdfd1e5 docs(readme): fix embedmd build 2017-07-02 16:34:52 +02:00
Javier Provecho Fernandez
912a7df572 docs(readme): fix step in vendor tool example 2017-07-02 16:28:37 +02:00
Javier Provecho Fernandez
84fc31f9f8 docs(readme): move contribution guide to a separate file 2017-07-02 14:35:10 +02:00
Javier Provecho Fernandez
5ce686113b docs(readme): add example on using vendor tool for version lock 2017-07-02 12:46:36 +02:00
Javier Provecho Fernandez
55dd6364cb docs(readme): update to color logo 2017-07-02 12:23:54 +02:00
Javier Provecho Fernandez
0cbf0f48aa docs(readme): update contribution guide
- change new prs base branch from develop to master
2017-07-02 11:58:19 +02:00
Javier Provecho Fernandez
2535b46bab docs(readme): add template func maps example
copied from gin_test.go @appleboy commit
2017-07-02 11:07:22 +02:00
Javier Provecho Fernandez
544b8b4dc8 docs(readme): switch deprecated bindwith for mustbindwith 2017-06-28 00:53:28 +02:00
Javier Provecho Fernandez
cbf414d600 docs(readme): add example on custom delims #860 2017-06-28 00:45:18 +02:00
Javier Provecho Fernandez
dc016d0bcb docs(readme): s/gopkg.in.../github.com.../ 2017-06-27 23:16:18 +02:00
Javier Provecho Fernandez
0b3f6d13be docs(readme): switch back import from gopkg to github 2017-06-27 23:03:29 +02:00
Javier Provecho Fernandez
d7ab0da647 Merge branch 'master' into develop 2017-06-27 22:39:09 +02:00
Manu MA
d5b353c5d5 Update README.md
Github does not render README correctly, missing whitespaces
2017-04-28 12:59:23 +02:00
Bo-Yi Wu
f8520b83f9 update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-04-17 13:41:47 +08:00