From 293d1ec32babe4d821d7d86053a1d14e7f16911b Mon Sep 17 00:00:00 2001 From: mjarkk Date: Sun, 17 Oct 2021 13:14:35 +0200 Subject: [PATCH] docs: add AttrIsID --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 79a75d3..f5813b9 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ struct { ### Label as ID field ```go -struct { +struct Foo { // Notice the "," before the id Id string `gq:",id"` @@ -158,6 +158,13 @@ struct { // NOTE NUMBERS WILL BE CONVERTED TO STRINGS IN OUTPUT PostId *int `gq:",id"` } + +// Label method response as ID using AttrIsID +// The value returned for AttrIsID is ignored +// You can also still just fine append an error: (string, AttrIsID, error) +func (Foo) ResolveExampleMethod() (string, AttrIsID) { + return "i'm an ID type", 0 +} ``` ### Methods and field arguments