repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
pilosa/pilosa
row.go
Shift
func (s *rowSegment) Shift() (*rowSegment, error) { //TODO deal with overflow data, err := s.data.Shift(1) if err != nil { return nil, errors.Wrap(err, "shifting roaring data") } return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), }, nil }
go
func (s *rowSegment) Shift() (*rowSegment, error) { //TODO deal with overflow data, err := s.data.Shift(1) if err != nil { return nil, errors.Wrap(err, "shifting roaring data") } return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), }, nil }
[ "func", "(", "s", "*", "rowSegment", ")", "Shift", "(", ")", "(", "*", "rowSegment", ",", "error", ")", "{", "//TODO deal with overflow", "data", ",", "err", ":=", "s", ".", "data", ".", "Shift", "(", "1", ")", "\n", "if", "err", "!=", "nil", "{", ...
// Shift returns s shifted by 1 bit.
[ "Shift", "returns", "s", "shifted", "by", "1", "bit", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L373-L385
train
pilosa/pilosa
row.go
ClearBit
func (s *rowSegment) ClearBit(i uint64) (changed bool) { s.ensureWritable() changed, _ = s.data.Remove(i) if changed { s.n-- } return changed }
go
func (s *rowSegment) ClearBit(i uint64) (changed bool) { s.ensureWritable() changed, _ = s.data.Remove(i) if changed { s.n-- } return changed }
[ "func", "(", "s", "*", "rowSegment", ")", "ClearBit", "(", "i", "uint64", ")", "(", "changed", "bool", ")", "{", "s", ".", "ensureWritable", "(", ")", "\n\n", "changed", ",", "_", "=", "s", ".", "data", ".", "Remove", "(", "i", ")", "\n", "if", ...
// ClearBit clears the i-th column of the row.
[ "ClearBit", "clears", "the", "i", "-", "th", "column", "of", "the", "row", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L398-L406
train
pilosa/pilosa
row.go
Columns
func (s *rowSegment) Columns() []uint64 { a := make([]uint64, 0, s.Count()) itr := s.data.Iterator() for v, eof := itr.Next(); !eof; v, eof = itr.Next() { a = append(a, v) } return a }
go
func (s *rowSegment) Columns() []uint64 { a := make([]uint64, 0, s.Count()) itr := s.data.Iterator() for v, eof := itr.Next(); !eof; v, eof = itr.Next() { a = append(a, v) } return a }
[ "func", "(", "s", "*", "rowSegment", ")", "Columns", "(", ")", "[", "]", "uint64", "{", "a", ":=", "make", "(", "[", "]", "uint64", ",", "0", ",", "s", ".", "Count", "(", ")", ")", "\n", "itr", ":=", "s", ".", "data", ".", "Iterator", "(", ...
// Columns returns a list of all columns set in the segment.
[ "Columns", "returns", "a", "list", "of", "all", "columns", "set", "in", "the", "segment", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L414-L421
train
pilosa/pilosa
row.go
ensureWritable
func (s *rowSegment) ensureWritable() { if s.writable { return } s.data = *s.data.Clone() s.writable = true }
go
func (s *rowSegment) ensureWritable() { if s.writable { return } s.data = *s.data.Clone() s.writable = true }
[ "func", "(", "s", "*", "rowSegment", ")", "ensureWritable", "(", ")", "{", "if", "s", ".", "writable", "{", "return", "\n", "}", "\n\n", "s", ".", "data", "=", "*", "s", ".", "data", ".", "Clone", "(", ")", "\n", "s", ".", "writable", "=", "tru...
// ensureWritable clones the segment if it is pointing to non-writable data.
[ "ensureWritable", "clones", "the", "segment", "if", "it", "is", "pointing", "to", "non", "-", "writable", "data", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L427-L434
train
pilosa/pilosa
row.go
newMergeSegmentIterator
func newMergeSegmentIterator(a0, a1 []rowSegment) mergeSegmentIterator { return mergeSegmentIterator{a0: a0, a1: a1} }
go
func newMergeSegmentIterator(a0, a1 []rowSegment) mergeSegmentIterator { return mergeSegmentIterator{a0: a0, a1: a1} }
[ "func", "newMergeSegmentIterator", "(", "a0", ",", "a1", "[", "]", "rowSegment", ")", "mergeSegmentIterator", "{", "return", "mergeSegmentIterator", "{", "a0", ":", "a0", ",", "a1", ":", "a1", "}", "\n", "}" ]
// newMergeSegmentIterator returns a new instance of mergeSegmentIterator.
[ "newMergeSegmentIterator", "returns", "a", "new", "instance", "of", "mergeSegmentIterator", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L442-L444
train
pilosa/pilosa
row.go
next
func (itr *mergeSegmentIterator) next() (s0, s1 *rowSegment) { // Find current segments. if len(itr.a0) > 0 { s0 = &itr.a0[0] } if len(itr.a1) > 0 { s1 = &itr.a1[0] } // Return if either or both are nil. if s0 == nil && s1 == nil { return } else if s0 == nil { itr.a1 = itr.a1[1:] return } else if s1...
go
func (itr *mergeSegmentIterator) next() (s0, s1 *rowSegment) { // Find current segments. if len(itr.a0) > 0 { s0 = &itr.a0[0] } if len(itr.a1) > 0 { s1 = &itr.a1[0] } // Return if either or both are nil. if s0 == nil && s1 == nil { return } else if s0 == nil { itr.a1 = itr.a1[1:] return } else if s1...
[ "func", "(", "itr", "*", "mergeSegmentIterator", ")", "next", "(", ")", "(", "s0", ",", "s1", "*", "rowSegment", ")", "{", "// Find current segments.", "if", "len", "(", "itr", ".", "a0", ")", ">", "0", "{", "s0", "=", "&", "itr", ".", "a0", "[", ...
// next returns the next set of segments.
[ "next", "returns", "the", "next", "set", "of", "segments", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L447-L479
train
pilosa/pilosa
internal/internal.go
Encode
func (enc *Encoder) Encode(pb proto.Message) error { buf, err := proto.Marshal(pb) if err != nil { return err } if _, err := enc.w.Write(buf); err != nil { return err } return nil }
go
func (enc *Encoder) Encode(pb proto.Message) error { buf, err := proto.Marshal(pb) if err != nil { return err } if _, err := enc.w.Write(buf); err != nil { return err } return nil }
[ "func", "(", "enc", "*", "Encoder", ")", "Encode", "(", "pb", "proto", ".", "Message", ")", "error", "{", "buf", ",", "err", ":=", "proto", ".", "Marshal", "(", "pb", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", ...
// Encode marshals m into bytes and writes them to r.
[ "Encode", "marshals", "m", "into", "bytes", "and", "writes", "them", "to", "r", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/internal/internal.go#L42-L53
train
pilosa/pilosa
internal/internal.go
Decode
func (dec *Decoder) Decode(pb proto.Message) error { buf, err := ioutil.ReadAll(dec.r) if err != nil { return err } return proto.Unmarshal(buf, pb) }
go
func (dec *Decoder) Decode(pb proto.Message) error { buf, err := ioutil.ReadAll(dec.r) if err != nil { return err } return proto.Unmarshal(buf, pb) }
[ "func", "(", "dec", "*", "Decoder", ")", "Decode", "(", "pb", "proto", ".", "Message", ")", "error", "{", "buf", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "dec", ".", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", ...
// Decode reads all bytes from the reader and unmarshals them into pb.
[ "Decode", "reads", "all", "bytes", "from", "the", "reader", "and", "unmarshals", "them", "into", "pb", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/internal/internal.go#L66-L73
train
line/line-bot-sdk-go
linebot/template.go
MarshalJSON
func (t *ButtonsTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type TemplateType `json:"type"` ThumbnailImageURL string `json:"thumbnailImageUrl,omitempty"` ImageAspectRatio ImageAspectRatioType `json:"imageAspectRatio,omitempty"` ImageSize ...
go
func (t *ButtonsTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type TemplateType `json:"type"` ThumbnailImageURL string `json:"thumbnailImageUrl,omitempty"` ImageAspectRatio ImageAspectRatioType `json:"imageAspectRatio,omitempty"` ImageSize ...
[ "func", "(", "t", "*", "ButtonsTemplate", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "TemplateType", "`json:\"type\"`", "\n", "ThumbnailImageURL", "string"...
// MarshalJSON method of ButtonsTemplate
[ "MarshalJSON", "method", "of", "ButtonsTemplate" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L68-L88
train
line/line-bot-sdk-go
linebot/template.go
WithImageOptions
func (t *ButtonsTemplate) WithImageOptions(imageAspectRatio ImageAspectRatioType, imageSize ImageSizeType, imageBackgroundColor string) *ButtonsTemplate { t.ImageAspectRatio = imageAspectRatio t.ImageSize = imageSize t.ImageBackgroundColor = imageBackgroundColor return t }
go
func (t *ButtonsTemplate) WithImageOptions(imageAspectRatio ImageAspectRatioType, imageSize ImageSizeType, imageBackgroundColor string) *ButtonsTemplate { t.ImageAspectRatio = imageAspectRatio t.ImageSize = imageSize t.ImageBackgroundColor = imageBackgroundColor return t }
[ "func", "(", "t", "*", "ButtonsTemplate", ")", "WithImageOptions", "(", "imageAspectRatio", "ImageAspectRatioType", ",", "imageSize", "ImageSizeType", ",", "imageBackgroundColor", "string", ")", "*", "ButtonsTemplate", "{", "t", ".", "ImageAspectRatio", "=", "imageAsp...
// WithImageOptions method, ButtonsTemplate can set imageAspectRatio, imageSize and imageBackgroundColor
[ "WithImageOptions", "method", "ButtonsTemplate", "can", "set", "imageAspectRatio", "imageSize", "and", "imageBackgroundColor" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L91-L96
train
line/line-bot-sdk-go
linebot/template.go
MarshalJSON
func (t *ConfirmTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type TemplateType `json:"type"` Text string `json:"text"` Actions []TemplateAction `json:"actions"` }{ Type: TemplateTypeConfirm, Text: t.Text, Actions: t.Actions, }) }
go
func (t *ConfirmTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type TemplateType `json:"type"` Text string `json:"text"` Actions []TemplateAction `json:"actions"` }{ Type: TemplateTypeConfirm, Text: t.Text, Actions: t.Actions, }) }
[ "func", "(", "t", "*", "ConfirmTemplate", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "TemplateType", "`json:\"type\"`", "\n", "Text", "string", "`json:\"...
// MarshalJSON method of ConfirmTemplate
[ "MarshalJSON", "method", "of", "ConfirmTemplate" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L105-L115
train
line/line-bot-sdk-go
linebot/template.go
MarshalJSON
func (t *CarouselTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type TemplateType `json:"type"` Columns []*CarouselColumn `json:"columns"` ImageAspectRatio ImageAspectRatioType `json:"imageAspectRatio,omitempty"` ImageSize ImageSizeType `js...
go
func (t *CarouselTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type TemplateType `json:"type"` Columns []*CarouselColumn `json:"columns"` ImageAspectRatio ImageAspectRatioType `json:"imageAspectRatio,omitempty"` ImageSize ImageSizeType `js...
[ "func", "(", "t", "*", "CarouselTemplate", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "TemplateType", "`json:\"type\"`", "\n", "Columns", "[", "]", "*"...
// MarshalJSON method of CarouselTemplate
[ "MarshalJSON", "method", "of", "CarouselTemplate" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L134-L146
train
line/line-bot-sdk-go
linebot/template.go
WithImageOptions
func (t *CarouselTemplate) WithImageOptions(imageAspectRatio ImageAspectRatioType, imageSize ImageSizeType) *CarouselTemplate { t.ImageAspectRatio = imageAspectRatio t.ImageSize = imageSize return t }
go
func (t *CarouselTemplate) WithImageOptions(imageAspectRatio ImageAspectRatioType, imageSize ImageSizeType) *CarouselTemplate { t.ImageAspectRatio = imageAspectRatio t.ImageSize = imageSize return t }
[ "func", "(", "t", "*", "CarouselTemplate", ")", "WithImageOptions", "(", "imageAspectRatio", "ImageAspectRatioType", ",", "imageSize", "ImageSizeType", ")", "*", "CarouselTemplate", "{", "t", ".", "ImageAspectRatio", "=", "imageAspectRatio", "\n", "t", ".", "ImageSi...
// WithImageOptions method, CarouselTemplate can set imageAspectRatio and imageSize
[ "WithImageOptions", "method", "CarouselTemplate", "can", "set", "imageAspectRatio", "and", "imageSize" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L149-L153
train
line/line-bot-sdk-go
linebot/template.go
WithImageOptions
func (t *CarouselColumn) WithImageOptions(imageBackgroundColor string) *CarouselColumn { t.ImageBackgroundColor = imageBackgroundColor return t }
go
func (t *CarouselColumn) WithImageOptions(imageBackgroundColor string) *CarouselColumn { t.ImageBackgroundColor = imageBackgroundColor return t }
[ "func", "(", "t", "*", "CarouselColumn", ")", "WithImageOptions", "(", "imageBackgroundColor", "string", ")", "*", "CarouselColumn", "{", "t", ".", "ImageBackgroundColor", "=", "imageBackgroundColor", "\n", "return", "t", "\n", "}" ]
// WithImageOptions method, CarouselColumn can set imageBackgroundColor
[ "WithImageOptions", "method", "CarouselColumn", "can", "set", "imageBackgroundColor" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L156-L159
train
line/line-bot-sdk-go
linebot/template.go
MarshalJSON
func (t *ImageCarouselTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type TemplateType `json:"type"` Columns []*ImageCarouselColumn `json:"columns"` }{ Type: TemplateTypeImageCarousel, Columns: t.Columns, }) }
go
func (t *ImageCarouselTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type TemplateType `json:"type"` Columns []*ImageCarouselColumn `json:"columns"` }{ Type: TemplateTypeImageCarousel, Columns: t.Columns, }) }
[ "func", "(", "t", "*", "ImageCarouselTemplate", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "TemplateType", "`json:\"type\"`", "\n", "Columns", "[", "]", ...
// MarshalJSON method of ImageCarouselTemplate
[ "MarshalJSON", "method", "of", "ImageCarouselTemplate" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L173-L181
train
line/line-bot-sdk-go
linebot/template.go
NewButtonsTemplate
func NewButtonsTemplate(thumbnailImageURL, title, text string, actions ...TemplateAction) *ButtonsTemplate { return &ButtonsTemplate{ ThumbnailImageURL: thumbnailImageURL, Title: title, Text: text, Actions: actions, } }
go
func NewButtonsTemplate(thumbnailImageURL, title, text string, actions ...TemplateAction) *ButtonsTemplate { return &ButtonsTemplate{ ThumbnailImageURL: thumbnailImageURL, Title: title, Text: text, Actions: actions, } }
[ "func", "NewButtonsTemplate", "(", "thumbnailImageURL", ",", "title", ",", "text", "string", ",", "actions", "...", "TemplateAction", ")", "*", "ButtonsTemplate", "{", "return", "&", "ButtonsTemplate", "{", "ThumbnailImageURL", ":", "thumbnailImageURL", ",", "Title"...
// NewButtonsTemplate function // `thumbnailImageURL` and `title` are optional. they can be empty.
[ "NewButtonsTemplate", "function", "thumbnailImageURL", "and", "title", "are", "optional", ".", "they", "can", "be", "empty", "." ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L205-L212
train
line/line-bot-sdk-go
linebot/template.go
NewCarouselColumn
func NewCarouselColumn(thumbnailImageURL, title, text string, actions ...TemplateAction) *CarouselColumn { return &CarouselColumn{ ThumbnailImageURL: thumbnailImageURL, Title: title, Text: text, Actions: actions, } }
go
func NewCarouselColumn(thumbnailImageURL, title, text string, actions ...TemplateAction) *CarouselColumn { return &CarouselColumn{ ThumbnailImageURL: thumbnailImageURL, Title: title, Text: text, Actions: actions, } }
[ "func", "NewCarouselColumn", "(", "thumbnailImageURL", ",", "title", ",", "text", "string", ",", "actions", "...", "TemplateAction", ")", "*", "CarouselColumn", "{", "return", "&", "CarouselColumn", "{", "ThumbnailImageURL", ":", "thumbnailImageURL", ",", "Title", ...
// NewCarouselColumn function // `thumbnailImageURL` and `title` are optional. they can be empty.
[ "NewCarouselColumn", "function", "thumbnailImageURL", "and", "title", "are", "optional", ".", "they", "can", "be", "empty", "." ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/template.go#L223-L230
train
line/line-bot-sdk-go
linebot/imagemap.go
MarshalJSON
func (a *URIImagemapAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ImagemapActionType `json:"type"` LinkURL string `json:"linkUri"` Area ImagemapArea `json:"area"` }{ Type: ImagemapActionTypeURI, LinkURL: a.LinkURL, Area: a.Area, }) }
go
func (a *URIImagemapAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ImagemapActionType `json:"type"` LinkURL string `json:"linkUri"` Area ImagemapArea `json:"area"` }{ Type: ImagemapActionTypeURI, LinkURL: a.LinkURL, Area: a.Area, }) }
[ "func", "(", "a", "*", "URIImagemapAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ImagemapActionType", "`json:\"type\"`", "\n", "LinkURL", "string", ...
// MarshalJSON method of URIImagemapAction
[ "MarshalJSON", "method", "of", "URIImagemapAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/imagemap.go#L71-L81
train
line/line-bot-sdk-go
linebot/imagemap.go
MarshalJSON
func (a *MessageImagemapAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ImagemapActionType `json:"type"` Text string `json:"text"` Area ImagemapArea `json:"area"` }{ Type: ImagemapActionTypeMessage, Text: a.Text, Area: a.Area, }) }
go
func (a *MessageImagemapAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ImagemapActionType `json:"type"` Text string `json:"text"` Area ImagemapArea `json:"area"` }{ Type: ImagemapActionTypeMessage, Text: a.Text, Area: a.Area, }) }
[ "func", "(", "a", "*", "MessageImagemapAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ImagemapActionType", "`json:\"type\"`", "\n", "Text", "string",...
// MarshalJSON method of MessageImagemapAction
[ "MarshalJSON", "method", "of", "MessageImagemapAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/imagemap.go#L90-L100
train
line/line-bot-sdk-go
linebot/client.go
New
func New(channelSecret, channelToken string, options ...ClientOption) (*Client, error) { if channelSecret == "" { return nil, errors.New("missing channel secret") } if channelToken == "" { return nil, errors.New("missing channel access token") } c := &Client{ channelSecret: channelSecret, channelToken: ch...
go
func New(channelSecret, channelToken string, options ...ClientOption) (*Client, error) { if channelSecret == "" { return nil, errors.New("missing channel secret") } if channelToken == "" { return nil, errors.New("missing channel access token") } c := &Client{ channelSecret: channelSecret, channelToken: ch...
[ "func", "New", "(", "channelSecret", ",", "channelToken", "string", ",", "options", "...", "ClientOption", ")", "(", "*", "Client", ",", "error", ")", "{", "if", "channelSecret", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "...
// New returns a new bot client instance.
[ "New", "returns", "a", "new", "bot", "client", "instance", "." ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/client.go#L79-L105
train
line/line-bot-sdk-go
linebot/flex_unmarshal.go
UnmarshalJSON
func (c *BoxComponent) UnmarshalJSON(data []byte) error { type alias BoxComponent raw := struct { Contents []rawFlexComponent `json:"contents"` *alias }{ alias: (*alias)(c), } if err := json.Unmarshal(data, &raw); err != nil { return err } components := make([]FlexComponent, len(raw.Contents)) for i, co...
go
func (c *BoxComponent) UnmarshalJSON(data []byte) error { type alias BoxComponent raw := struct { Contents []rawFlexComponent `json:"contents"` *alias }{ alias: (*alias)(c), } if err := json.Unmarshal(data, &raw); err != nil { return err } components := make([]FlexComponent, len(raw.Contents)) for i, co...
[ "func", "(", "c", "*", "BoxComponent", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "type", "alias", "BoxComponent", "\n", "raw", ":=", "struct", "{", "Contents", "[", "]", "rawFlexComponent", "`json:\"contents\"`", "\n", "*", "a...
// UnmarshalJSON method for BoxComponent
[ "UnmarshalJSON", "method", "for", "BoxComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex_unmarshal.go#L132-L149
train
line/line-bot-sdk-go
linebot/flex_unmarshal.go
UnmarshalJSON
func (c *ButtonComponent) UnmarshalJSON(data []byte) error { type alias ButtonComponent raw := struct { Action rawAction `json:"action"` *alias }{ alias: (*alias)(c), } if err := json.Unmarshal(data, &raw); err != nil { return err } c.Action = raw.Action.Action return nil }
go
func (c *ButtonComponent) UnmarshalJSON(data []byte) error { type alias ButtonComponent raw := struct { Action rawAction `json:"action"` *alias }{ alias: (*alias)(c), } if err := json.Unmarshal(data, &raw); err != nil { return err } c.Action = raw.Action.Action return nil }
[ "func", "(", "c", "*", "ButtonComponent", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "type", "alias", "ButtonComponent", "\n", "raw", ":=", "struct", "{", "Action", "rawAction", "`json:\"action\"`", "\n", "*", "alias", "\n", "}...
// UnmarshalJSON method for ButtonComponent
[ "UnmarshalJSON", "method", "for", "ButtonComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex_unmarshal.go#L152-L165
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *BubbleContainer) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexContainerType `json:"type"` Direction FlexBubbleDirectionType `json:"direction,omitempty"` Header *BoxComponent `json:"header,omitempty"` Hero *ImageComponent `json:"hero,omitem...
go
func (c *BubbleContainer) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexContainerType `json:"type"` Direction FlexBubbleDirectionType `json:"direction,omitempty"` Header *BoxComponent `json:"header,omitempty"` Hero *ImageComponent `json:"hero,omitem...
[ "func", "(", "c", "*", "BubbleContainer", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexContainerType", "`json:\"type\"`", "\n", "Direction", "FlexBubble...
// MarshalJSON method of BubbleContainer
[ "MarshalJSON", "method", "of", "BubbleContainer" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L263-L281
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *CarouselContainer) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexContainerType `json:"type"` Contents []*BubbleContainer `json:"contents"` }{ Type: FlexContainerTypeCarousel, Contents: c.Contents, }) }
go
func (c *CarouselContainer) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexContainerType `json:"type"` Contents []*BubbleContainer `json:"contents"` }{ Type: FlexContainerTypeCarousel, Contents: c.Contents, }) }
[ "func", "(", "c", "*", "CarouselContainer", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexContainerType", "`json:\"type\"`", "\n", "Contents", "[", "]"...
// MarshalJSON method of CarouselContainer
[ "MarshalJSON", "method", "of", "CarouselContainer" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L290-L298
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *BoxComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Layout FlexBoxLayoutType `json:"layout"` Contents []FlexComponent `json:"contents"` Flex *int `json:"flex,omitempty"` Spacing FlexCom...
go
func (c *BoxComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Layout FlexBoxLayoutType `json:"layout"` Contents []FlexComponent `json:"contents"` Flex *int `json:"flex,omitempty"` Spacing FlexCom...
[ "func", "(", "c", "*", "BoxComponent", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexComponentType", "`json:\"type\"`", "\n", "Layout", "FlexBoxLayoutTyp...
// MarshalJSON method of BoxComponent
[ "MarshalJSON", "method", "of", "BoxComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L337-L353
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *ButtonComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Action TemplateAction `json:"action"` Flex *int `json:"flex,omitempty"` Margin FlexComponentMarginType `json:"margin,omitempty"` Height F...
go
func (c *ButtonComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Action TemplateAction `json:"action"` Flex *int `json:"flex,omitempty"` Margin FlexComponentMarginType `json:"margin,omitempty"` Height F...
[ "func", "(", "c", "*", "ButtonComponent", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexComponentType", "`json:\"type\"`", "\n", "Action", "TemplateActio...
// MarshalJSON method of ButtonComponent
[ "MarshalJSON", "method", "of", "ButtonComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L368-L388
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *FillerComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` }{ Type: FlexComponentTypeFiller, }) }
go
func (c *FillerComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` }{ Type: FlexComponentTypeFiller, }) }
[ "func", "(", "c", "*", "FillerComponent", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexComponentType", "`json:\"type\"`", "\n", "}", "{", "Type", ":...
// MarshalJSON method of FillerComponent
[ "MarshalJSON", "method", "of", "FillerComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L396-L402
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *IconComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` URL string `json:"url"` Margin FlexComponentMarginType `json:"margin,omitempty"` Size FlexIconSizeType `json:"size,omitempty"` As...
go
func (c *IconComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` URL string `json:"url"` Margin FlexComponentMarginType `json:"margin,omitempty"` Size FlexIconSizeType `json:"size,omitempty"` As...
[ "func", "(", "c", "*", "IconComponent", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexComponentType", "`json:\"type\"`", "\n", "URL", "string", "`json:...
// MarshalJSON method of IconComponent
[ "MarshalJSON", "method", "of", "IconComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L414-L428
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *ImageComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` URL string `json:"url"` Flex *int `json:"flex,omitempty"` Margin FlexComponentMarginType `json:"ma...
go
func (c *ImageComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` URL string `json:"url"` Flex *int `json:"flex,omitempty"` Margin FlexComponentMarginType `json:"ma...
[ "func", "(", "c", "*", "ImageComponent", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexComponentType", "`json:\"type\"`", "\n", "URL", "string", "`json...
// MarshalJSON method of ImageComponent
[ "MarshalJSON", "method", "of", "ImageComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L446-L472
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *SeparatorComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Margin FlexComponentMarginType `json:"margin,omitempty"` Color string `json:"color,omitempty"` }{ Type: FlexComponentTypeSeparator, Margin: c.Margin, ...
go
func (c *SeparatorComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Margin FlexComponentMarginType `json:"margin,omitempty"` Color string `json:"color,omitempty"` }{ Type: FlexComponentTypeSeparator, Margin: c.Margin, ...
[ "func", "(", "c", "*", "SeparatorComponent", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexComponentType", "`json:\"type\"`", "\n", "Margin", "FlexCompon...
// MarshalJSON method of SeparatorComponent
[ "MarshalJSON", "method", "of", "SeparatorComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L482-L492
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *SpacerComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Size FlexSpacerSizeType `json:"size,omitempty"` }{ Type: FlexComponentTypeSpacer, Size: c.Size, }) }
go
func (c *SpacerComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Size FlexSpacerSizeType `json:"size,omitempty"` }{ Type: FlexComponentTypeSpacer, Size: c.Size, }) }
[ "func", "(", "c", "*", "SpacerComponent", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexComponentType", "`json:\"type\"`", "\n", "Size", "FlexSpacerSizeT...
// MarshalJSON method of SpacerComponent
[ "MarshalJSON", "method", "of", "SpacerComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L501-L509
train
line/line-bot-sdk-go
linebot/flex.go
MarshalJSON
func (c *TextComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Text string `json:"text"` Flex *int `json:"flex,omitempty"` Margin FlexComponentMarginType `json:"margin,omitempty"` Size FlexT...
go
func (c *TextComponent) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type FlexComponentType `json:"type"` Text string `json:"text"` Flex *int `json:"flex,omitempty"` Margin FlexComponentMarginType `json:"margin,omitempty"` Size FlexT...
[ "func", "(", "c", "*", "TextComponent", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "FlexComponentType", "`json:\"type\"`", "\n", "Text", "string", "`json...
// MarshalJSON method of TextComponent
[ "MarshalJSON", "method", "of", "TextComponent" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/flex.go#L527-L553
train
line/line-bot-sdk-go
linebot/event.go
MarshalJSON
func (e *Event) MarshalJSON() ([]byte, error) { raw := rawEvent{ ReplyToken: e.ReplyToken, Type: e.Type, Timestamp: e.Timestamp.Unix()*millisecPerSec + int64(e.Timestamp.Nanosecond())/int64(time.Millisecond), Source: e.Source, Postback: e.Postback, } if e.Beacon != nil { raw.Beacon = &rawBea...
go
func (e *Event) MarshalJSON() ([]byte, error) { raw := rawEvent{ ReplyToken: e.ReplyToken, Type: e.Type, Timestamp: e.Timestamp.Unix()*millisecPerSec + int64(e.Timestamp.Nanosecond())/int64(time.Millisecond), Source: e.Source, Postback: e.Postback, } if e.Beacon != nil { raw.Beacon = &rawBea...
[ "func", "(", "e", "*", "Event", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "raw", ":=", "rawEvent", "{", "ReplyToken", ":", "e", ".", "ReplyToken", ",", "Type", ":", "e", ".", "Type", ",", "Timestamp", ":", "e", ...
// MarshalJSON method of Event
[ "MarshalJSON", "method", "of", "Event" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/event.go#L181-L267
train
line/line-bot-sdk-go
linebot/event.go
UnmarshalJSON
func (e *Event) UnmarshalJSON(body []byte) (err error) { rawEvent := rawEvent{} if err = json.Unmarshal(body, &rawEvent); err != nil { return } e.ReplyToken = rawEvent.ReplyToken e.Type = rawEvent.Type e.Timestamp = time.Unix(rawEvent.Timestamp/millisecPerSec, (rawEvent.Timestamp%millisecPerSec)*nanosecPerMill...
go
func (e *Event) UnmarshalJSON(body []byte) (err error) { rawEvent := rawEvent{} if err = json.Unmarshal(body, &rawEvent); err != nil { return } e.ReplyToken = rawEvent.ReplyToken e.Type = rawEvent.Type e.Timestamp = time.Unix(rawEvent.Timestamp/millisecPerSec, (rawEvent.Timestamp%millisecPerSec)*nanosecPerMill...
[ "func", "(", "e", "*", "Event", ")", "UnmarshalJSON", "(", "body", "[", "]", "byte", ")", "(", "err", "error", ")", "{", "rawEvent", ":=", "rawEvent", "{", "}", "\n", "if", "err", "=", "json", ".", "Unmarshal", "(", "body", ",", "&", "rawEvent", ...
// UnmarshalJSON method of Event
[ "UnmarshalJSON", "method", "of", "Event" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/event.go#L270-L351
train
line/line-bot-sdk-go
linebot/quick_reply.go
MarshalJSON
func (b *QuickReplyButton) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type string `json:"type"` ImageURL string `json:"imageUrl,omitempty"` Action QuickReplyAction `json:"action"` }{ Type: "action", ImageURL: b.ImageURL, Action: b.Action, }) }
go
func (b *QuickReplyButton) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type string `json:"type"` ImageURL string `json:"imageUrl,omitempty"` Action QuickReplyAction `json:"action"` }{ Type: "action", ImageURL: b.ImageURL, Action: b.Action, }) }
[ "func", "(", "b", "*", "QuickReplyButton", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "string", "`json:\"type\"`", "\n", "ImageURL", "string", "`json:\"i...
// MarshalJSON method of QuickReplyButton
[ "MarshalJSON", "method", "of", "QuickReplyButton" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/quick_reply.go#L40-L50
train
line/line-bot-sdk-go
linebot/actions.go
MarshalJSON
func (a *URIAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label,omitempty"` URI string `json:"uri"` AltURI *URIActionAltURI `json:"altUri,omitempty"` }{ Type: ActionTypeURI, Label: a.Label, URI: ...
go
func (a *URIAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label,omitempty"` URI string `json:"uri"` AltURI *URIActionAltURI `json:"altUri,omitempty"` }{ Type: ActionTypeURI, Label: a.Label, URI: ...
[ "func", "(", "a", "*", "URIAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ActionType", "`json:\"type\"`", "\n", "Label", "string", "`json:\"label,o...
// MarshalJSON method of URIAction
[ "MarshalJSON", "method", "of", "URIAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/actions.go#L63-L75
train
line/line-bot-sdk-go
linebot/actions.go
MarshalJSON
func (a *MessageAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label,omitempty"` Text string `json:"text"` }{ Type: ActionTypeMessage, Label: a.Label, Text: a.Text, }) }
go
func (a *MessageAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label,omitempty"` Text string `json:"text"` }{ Type: ActionTypeMessage, Label: a.Label, Text: a.Text, }) }
[ "func", "(", "a", "*", "MessageAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ActionType", "`json:\"type\"`", "\n", "Label", "string", "`json:\"lab...
// MarshalJSON method of MessageAction
[ "MarshalJSON", "method", "of", "MessageAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/actions.go#L84-L94
train
line/line-bot-sdk-go
linebot/actions.go
MarshalJSON
func (a *PostbackAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label,omitempty"` Data string `json:"data"` Text string `json:"text,omitempty"` DisplayText string `json:"displayText,omitempty"`...
go
func (a *PostbackAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label,omitempty"` Data string `json:"data"` Text string `json:"text,omitempty"` DisplayText string `json:"displayText,omitempty"`...
[ "func", "(", "a", "*", "PostbackAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ActionType", "`json:\"type\"`", "\n", "Label", "string", "`json:\"la...
// MarshalJSON method of PostbackAction
[ "MarshalJSON", "method", "of", "PostbackAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/actions.go#L105-L119
train
line/line-bot-sdk-go
linebot/actions.go
MarshalJSON
func (a *DatetimePickerAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label,omitempty"` Data string `json:"data"` Mode string `json:"mode"` Initial string `json:"initial,omitempty"` Max string `json:...
go
func (a *DatetimePickerAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label,omitempty"` Data string `json:"data"` Mode string `json:"mode"` Initial string `json:"initial,omitempty"` Max string `json:...
[ "func", "(", "a", "*", "DatetimePickerAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ActionType", "`json:\"type\"`", "\n", "Label", "string", "`jso...
// MarshalJSON method of DatetimePickerAction
[ "MarshalJSON", "method", "of", "DatetimePickerAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/actions.go#L132-L150
train
line/line-bot-sdk-go
linebot/actions.go
MarshalJSON
func (a *CameraAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label"` }{ Type: ActionTypeCamera, Label: a.Label, }) }
go
func (a *CameraAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label"` }{ Type: ActionTypeCamera, Label: a.Label, }) }
[ "func", "(", "a", "*", "CameraAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ActionType", "`json:\"type\"`", "\n", "Label", "string", "`json:\"labe...
// MarshalJSON method of CameraAction
[ "MarshalJSON", "method", "of", "CameraAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/actions.go#L158-L166
train
line/line-bot-sdk-go
linebot/actions.go
MarshalJSON
func (a *CameraRollAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label"` }{ Type: ActionTypeCameraRoll, Label: a.Label, }) }
go
func (a *CameraRollAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label"` }{ Type: ActionTypeCameraRoll, Label: a.Label, }) }
[ "func", "(", "a", "*", "CameraRollAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ActionType", "`json:\"type\"`", "\n", "Label", "string", "`json:\"...
// MarshalJSON method of CameraRollAction
[ "MarshalJSON", "method", "of", "CameraRollAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/actions.go#L174-L182
train
line/line-bot-sdk-go
linebot/actions.go
MarshalJSON
func (a *LocationAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label"` }{ Type: ActionTypeLocation, Label: a.Label, }) }
go
func (a *LocationAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` Label string `json:"label"` }{ Type: ActionTypeLocation, Label: a.Label, }) }
[ "func", "(", "a", "*", "LocationAction", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "ActionType", "`json:\"type\"`", "\n", "Label", "string", "`json:\"la...
// MarshalJSON method of LocationAction
[ "MarshalJSON", "method", "of", "LocationAction" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/actions.go#L190-L198
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *TextMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` Text string `json:"text"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeText, Text: m.Text, QuickReply: m.quickReplyitem...
go
func (m *TextMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` Text string `json:"text"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeText, Text: m.Text, QuickReply: m.quickReplyitem...
[ "func", "(", "m", "*", "TextMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "Text", "string", "`json:\"text\...
// MarshalJSON method of TextMessage
[ "MarshalJSON", "method", "of", "TextMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L58-L68
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *TextMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *TextMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "TextMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of TextMessage
[ "WithQuickReplies", "method", "of", "TextMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L71-L74
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *ImageMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` OriginalContentURL string `json:"originalContentUrl"` PreviewImageURL string `json:"previewImageUrl"` QuickReply *QuickReplyItems `json:"quickRep...
go
func (m *ImageMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` OriginalContentURL string `json:"originalContentUrl"` PreviewImageURL string `json:"previewImageUrl"` QuickReply *QuickReplyItems `json:"quickRep...
[ "func", "(", "m", "*", "ImageMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "OriginalContentURL", "string", ...
// MarshalJSON method of ImageMessage
[ "MarshalJSON", "method", "of", "ImageMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L86-L98
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *ImageMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *ImageMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "ImageMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of ImageMessage
[ "WithQuickReplies", "method", "of", "ImageMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L101-L104
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *VideoMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` OriginalContentURL string `json:"originalContentUrl"` PreviewImageURL string `json:"previewImageUrl"` QuickReply *QuickReplyItems `json:"quickRep...
go
func (m *VideoMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` OriginalContentURL string `json:"originalContentUrl"` PreviewImageURL string `json:"previewImageUrl"` QuickReply *QuickReplyItems `json:"quickRep...
[ "func", "(", "m", "*", "VideoMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "OriginalContentURL", "string", ...
// MarshalJSON method of VideoMessage
[ "MarshalJSON", "method", "of", "VideoMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L116-L128
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *VideoMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *VideoMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "VideoMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of VideoMessage
[ "WithQuickReplies", "method", "of", "VideoMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L131-L134
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *AudioMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` OriginalContentURL string `json:"originalContentUrl"` Duration int `json:"duration"` QuickReply *QuickReplyItems `json:"quickReply,omit...
go
func (m *AudioMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` OriginalContentURL string `json:"originalContentUrl"` Duration int `json:"duration"` QuickReply *QuickReplyItems `json:"quickReply,omit...
[ "func", "(", "m", "*", "AudioMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "OriginalContentURL", "string", ...
// MarshalJSON method of AudioMessage
[ "MarshalJSON", "method", "of", "AudioMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L146-L158
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *AudioMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *AudioMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "AudioMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of AudioMessage
[ "WithQuickReplies", "method", "of", "AudioMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L161-L164
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *LocationMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` Title string `json:"title"` Address string `json:"address"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"...
go
func (m *LocationMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` Title string `json:"title"` Address string `json:"address"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"...
[ "func", "(", "m", "*", "LocationMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "Title", "string", "`json:\"...
// MarshalJSON method of LocationMessage
[ "MarshalJSON", "method", "of", "LocationMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L185-L201
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *LocationMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *LocationMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "LocationMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of LocationMessage
[ "WithQuickReplies", "method", "of", "LocationMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L204-L207
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *StickerMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` PackageID string `json:"packageId"` StickerID string `json:"stickerId"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeS...
go
func (m *StickerMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` PackageID string `json:"packageId"` StickerID string `json:"stickerId"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeS...
[ "func", "(", "m", "*", "StickerMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "PackageID", "string", "`json...
// MarshalJSON method of StickerMessage
[ "MarshalJSON", "method", "of", "StickerMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L219-L231
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *StickerMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *StickerMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "StickerMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of StickerMessage
[ "WithQuickReplies", "method", "of", "StickerMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L234-L237
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *TemplateMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` AltText string `json:"altText"` Template Template `json:"template"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeTem...
go
func (m *TemplateMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` AltText string `json:"altText"` Template Template `json:"template"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeTem...
[ "func", "(", "m", "*", "TemplateMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "AltText", "string", "`json:...
// MarshalJSON method of TemplateMessage
[ "MarshalJSON", "method", "of", "TemplateMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L248-L260
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *TemplateMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *TemplateMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "TemplateMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of TemplateMessage
[ "WithQuickReplies", "method", "of", "TemplateMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L263-L266
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *ImagemapMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` BaseURL string `json:"baseUrl"` AltText string `json:"altText"` BaseSize ImagemapBaseSize `json:"baseSize"` Actions []ImagemapAction `json:"actions"...
go
func (m *ImagemapMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` BaseURL string `json:"baseUrl"` AltText string `json:"altText"` BaseSize ImagemapBaseSize `json:"baseSize"` Actions []ImagemapAction `json:"actions"...
[ "func", "(", "m", "*", "ImagemapMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "BaseURL", "string", "`json:...
// MarshalJSON method of ImagemapMessage
[ "MarshalJSON", "method", "of", "ImagemapMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L280-L298
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *ImagemapMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *ImagemapMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "ImagemapMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of ImagemapMessage
[ "WithQuickReplies", "method", "of", "ImagemapMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L307-L310
train
line/line-bot-sdk-go
linebot/message.go
MarshalJSON
func (m *FlexMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` AltText string `json:"altText"` Contents interface{} `json:"contents"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeFlex, ...
go
func (m *FlexMessage) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type MessageType `json:"type"` AltText string `json:"altText"` Contents interface{} `json:"contents"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeFlex, ...
[ "func", "(", "m", "*", "FlexMessage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "&", "struct", "{", "Type", "MessageType", "`json:\"type\"`", "\n", "AltText", "string", "`json:\"al...
// MarshalJSON method of FlexMessage
[ "MarshalJSON", "method", "of", "FlexMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L321-L333
train
line/line-bot-sdk-go
linebot/message.go
WithQuickReplies
func (m *FlexMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
go
func (m *FlexMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { m.quickReplyitems = items return m }
[ "func", "(", "m", "*", "FlexMessage", ")", "WithQuickReplies", "(", "items", "*", "QuickReplyItems", ")", "SendingMessage", "{", "m", ".", "quickReplyitems", "=", "items", "\n", "return", "m", "\n", "}" ]
// WithQuickReplies method of FlexMessage
[ "WithQuickReplies", "method", "of", "FlexMessage" ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/message.go#L336-L339
train
line/line-bot-sdk-go
linebot/get_ids.go
NewScanner
func (call *GetGroupMemberIDsCall) NewScanner() *IDsScanner { var ctx context.Context if call.ctx != nil { ctx = call.ctx } else { ctx = context.Background() } c2 := &GetGroupMemberIDsCall{} *c2 = *call c2.ctx = ctx return &IDsScanner{ caller: c2, ctx: ctx, } }
go
func (call *GetGroupMemberIDsCall) NewScanner() *IDsScanner { var ctx context.Context if call.ctx != nil { ctx = call.ctx } else { ctx = context.Background() } c2 := &GetGroupMemberIDsCall{} *c2 = *call c2.ctx = ctx return &IDsScanner{ caller: c2, ctx: ctx, } }
[ "func", "(", "call", "*", "GetGroupMemberIDsCall", ")", "NewScanner", "(", ")", "*", "IDsScanner", "{", "var", "ctx", "context", ".", "Context", "\n", "if", "call", ".", "ctx", "!=", "nil", "{", "ctx", "=", "call", ".", "ctx", "\n", "}", "else", "{",...
// NewScanner returns Group IDs scanner.
[ "NewScanner", "returns", "Group", "IDs", "scanner", "." ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/get_ids.go#L102-L118
train
line/line-bot-sdk-go
linebot/get_ids.go
ID
func (s *IDsScanner) ID() string { if len(s.ids) == 0 { return "" } return s.ids[s.start : s.start+1][0] }
go
func (s *IDsScanner) ID() string { if len(s.ids) == 0 { return "" } return s.ids[s.start : s.start+1][0] }
[ "func", "(", "s", "*", "IDsScanner", ")", "ID", "(", ")", "string", "{", "if", "len", "(", "s", ".", "ids", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "s", ".", "ids", "[", "s", ".", "start", ":", "s", ".", "start...
// ID returns member id.
[ "ID", "returns", "member", "id", "." ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/get_ids.go#L204-L209
train
line/line-bot-sdk-go
linebot/httphandler/httphandler.go
New
func New(channelSecret, channelToken string) (*WebhookHandler, error) { if channelSecret == "" { return nil, errors.New("missing channel secret") } if channelToken == "" { return nil, errors.New("missing channel access token") } h := &WebhookHandler{ channelSecret: channelSecret, channelToken: channelToke...
go
func New(channelSecret, channelToken string) (*WebhookHandler, error) { if channelSecret == "" { return nil, errors.New("missing channel secret") } if channelToken == "" { return nil, errors.New("missing channel access token") } h := &WebhookHandler{ channelSecret: channelSecret, channelToken: channelToke...
[ "func", "New", "(", "channelSecret", ",", "channelToken", "string", ")", "(", "*", "WebhookHandler", ",", "error", ")", "{", "if", "channelSecret", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\...
// New returns a new WebhookHandler instance.
[ "New", "returns", "a", "new", "WebhookHandler", "instance", "." ]
e03995617323053fcafcf0bfe1a66aa96b26ac01
https://github.com/line/line-bot-sdk-go/blob/e03995617323053fcafcf0bfe1a66aa96b26ac01/linebot/httphandler/httphandler.go#L40-L52
train
nicksnyder/go-i18n
v2/i18n/localizer.go
Localize
func (l *Localizer) Localize(lc *LocalizeConfig) (string, error) { msg, _, err := l.LocalizeWithTag(lc) return msg, err }
go
func (l *Localizer) Localize(lc *LocalizeConfig) (string, error) { msg, _, err := l.LocalizeWithTag(lc) return msg, err }
[ "func", "(", "l", "*", "Localizer", ")", "Localize", "(", "lc", "*", "LocalizeConfig", ")", "(", "string", ",", "error", ")", "{", "msg", ",", "_", ",", "err", ":=", "l", ".", "LocalizeWithTag", "(", "lc", ")", "\n", "return", "msg", ",", "err", ...
// Localize returns a localized message.
[ "Localize", "returns", "a", "localized", "message", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/localizer.go#L104-L107
train
nicksnyder/go-i18n
v2/i18n/localizer.go
LocalizeWithTag
func (l *Localizer) LocalizeWithTag(lc *LocalizeConfig) (string, language.Tag, error) { messageID := lc.MessageID if lc.DefaultMessage != nil { if messageID != "" && messageID != lc.DefaultMessage.ID { return "", language.Und, &messageIDMismatchErr{messageID: messageID, defaultMessageID: lc.DefaultMessage.ID} ...
go
func (l *Localizer) LocalizeWithTag(lc *LocalizeConfig) (string, language.Tag, error) { messageID := lc.MessageID if lc.DefaultMessage != nil { if messageID != "" && messageID != lc.DefaultMessage.ID { return "", language.Und, &messageIDMismatchErr{messageID: messageID, defaultMessageID: lc.DefaultMessage.ID} ...
[ "func", "(", "l", "*", "Localizer", ")", "LocalizeWithTag", "(", "lc", "*", "LocalizeConfig", ")", "(", "string", ",", "language", ".", "Tag", ",", "error", ")", "{", "messageID", ":=", "lc", ".", "MessageID", "\n", "if", "lc", ".", "DefaultMessage", "...
// LocalizeWithTag returns a localized message and the language tag.
[ "LocalizeWithTag", "returns", "a", "localized", "message", "and", "the", "language", "tag", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/localizer.go#L110-L146
train
nicksnyder/go-i18n
v2/i18n/localizer.go
MustLocalize
func (l *Localizer) MustLocalize(lc *LocalizeConfig) string { localized, err := l.Localize(lc) if err != nil { panic(err) } return localized }
go
func (l *Localizer) MustLocalize(lc *LocalizeConfig) string { localized, err := l.Localize(lc) if err != nil { panic(err) } return localized }
[ "func", "(", "l", "*", "Localizer", ")", "MustLocalize", "(", "lc", "*", "LocalizeConfig", ")", "string", "{", "localized", ",", "err", ":=", "l", ".", "Localize", "(", "lc", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n",...
// MustLocalize is similar to Localize, except it panics if an error happens.
[ "MustLocalize", "is", "similar", "to", "Localize", "except", "it", "panics", "if", "an", "error", "happens", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/localizer.go#L203-L209
train
nicksnyder/go-i18n
v2/internal/parse.go
ParseMessageFileBytes
func ParseMessageFileBytes(buf []byte, path string, unmarshalFuncs map[string]UnmarshalFunc) (*MessageFile, error) { lang, format := parsePath(path) tag := language.Make(lang) messageFile := &MessageFile{ Path: path, Tag: tag, Format: format, } if len(buf) == 0 { return messageFile, nil } unmarshalF...
go
func ParseMessageFileBytes(buf []byte, path string, unmarshalFuncs map[string]UnmarshalFunc) (*MessageFile, error) { lang, format := parsePath(path) tag := language.Make(lang) messageFile := &MessageFile{ Path: path, Tag: tag, Format: format, } if len(buf) == 0 { return messageFile, nil } unmarshalF...
[ "func", "ParseMessageFileBytes", "(", "buf", "[", "]", "byte", ",", "path", "string", ",", "unmarshalFuncs", "map", "[", "string", "]", "UnmarshalFunc", ")", "(", "*", "MessageFile", ",", "error", ")", "{", "lang", ",", "format", ":=", "parsePath", "(", ...
// ParseMessageFileBytes returns the messages parsed from file.
[ "ParseMessageFileBytes", "returns", "the", "messages", "parsed", "from", "file", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/internal/parse.go#L24-L54
train
nicksnyder/go-i18n
v2/internal/parse.go
recGetMessages
func recGetMessages(raw interface{}, isMapMessage, isInitialCall bool) ([]*Message, error) { var messages []*Message var err error switch data := raw.(type) { case string: if isInitialCall { return nil, errInvalidTranslationFile } m, err := NewMessage(data) return []*Message{m}, err case map[string]in...
go
func recGetMessages(raw interface{}, isMapMessage, isInitialCall bool) ([]*Message, error) { var messages []*Message var err error switch data := raw.(type) { case string: if isInitialCall { return nil, errInvalidTranslationFile } m, err := NewMessage(data) return []*Message{m}, err case map[string]in...
[ "func", "recGetMessages", "(", "raw", "interface", "{", "}", ",", "isMapMessage", ",", "isInitialCall", "bool", ")", "(", "[", "]", "*", "Message", ",", "error", ")", "{", "var", "messages", "[", "]", "*", "Message", "\n", "var", "err", "error", "\n\n"...
// recGetMessages looks for translation messages inside "raw" parameter, // scanning nested maps using recursion.
[ "recGetMessages", "looks", "for", "translation", "messages", "inside", "raw", "parameter", "scanning", "nested", "maps", "using", "recursion", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/internal/parse.go#L62-L123
train
nicksnyder/go-i18n
v2/goi18n/extract_command.go
extractMessages
func extractMessages(buf []byte) ([]*i18n.Message, error) { fset := token.NewFileSet() file, err := parser.ParseFile(fset, "", buf, parser.AllErrors) if err != nil { return nil, err } extractor := newExtractor(file) ast.Walk(extractor, file) return extractor.messages, nil }
go
func extractMessages(buf []byte) ([]*i18n.Message, error) { fset := token.NewFileSet() file, err := parser.ParseFile(fset, "", buf, parser.AllErrors) if err != nil { return nil, err } extractor := newExtractor(file) ast.Walk(extractor, file) return extractor.messages, nil }
[ "func", "extractMessages", "(", "buf", "[", "]", "byte", ")", "(", "[", "]", "*", "i18n", ".", "Message", ",", "error", ")", "{", "fset", ":=", "token", ".", "NewFileSet", "(", ")", "\n", "file", ",", "err", ":=", "parser", ".", "ParseFile", "(", ...
// extractMessages extracts messages from the bytes of a Go source file.
[ "extractMessages", "extracts", "messages", "from", "the", "bytes", "of", "a", "Go", "source", "file", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/goi18n/extract_command.go#L117-L126
train
nicksnyder/go-i18n
i18n/language/pluralspec.go
RegisterPluralSpec
func RegisterPluralSpec(ids []string, ps *PluralSpec) { for _, id := range ids { id = normalizePluralSpecID(id) pluralSpecs[id] = ps } }
go
func RegisterPluralSpec(ids []string, ps *PluralSpec) { for _, id := range ids { id = normalizePluralSpecID(id) pluralSpecs[id] = ps } }
[ "func", "RegisterPluralSpec", "(", "ids", "[", "]", "string", ",", "ps", "*", "PluralSpec", ")", "{", "for", "_", ",", "id", ":=", "range", "ids", "{", "id", "=", "normalizePluralSpecID", "(", "id", ")", "\n", "pluralSpecs", "[", "id", "]", "=", "ps"...
// RegisterPluralSpec registers a new plural spec for the language ids.
[ "RegisterPluralSpec", "registers", "a", "new", "plural", "spec", "for", "the", "language", "ids", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/pluralspec.go#L22-L27
train
nicksnyder/go-i18n
i18n/language/pluralspec.go
Plural
func (ps *PluralSpec) Plural(number interface{}) (Plural, error) { ops, err := newOperands(number) if err != nil { return Invalid, err } return ps.PluralFunc(ops), nil }
go
func (ps *PluralSpec) Plural(number interface{}) (Plural, error) { ops, err := newOperands(number) if err != nil { return Invalid, err } return ps.PluralFunc(ops), nil }
[ "func", "(", "ps", "*", "PluralSpec", ")", "Plural", "(", "number", "interface", "{", "}", ")", "(", "Plural", ",", "error", ")", "{", "ops", ",", "err", ":=", "newOperands", "(", "number", ")", "\n", "if", "err", "!=", "nil", "{", "return", "Inval...
// Plural returns the plural category for number as defined by // the language's CLDR plural rules.
[ "Plural", "returns", "the", "plural", "category", "for", "number", "as", "defined", "by", "the", "language", "s", "CLDR", "plural", "rules", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/pluralspec.go#L31-L37
train
nicksnyder/go-i18n
i18n/language/pluralspec.go
GetPluralSpec
func GetPluralSpec(tag string) *PluralSpec { tag = NormalizeTag(tag) subtag := tag for { if spec := pluralSpecs[subtag]; spec != nil { return spec } end := strings.LastIndex(subtag, "-") if end == -1 { return nil } subtag = subtag[:end] } }
go
func GetPluralSpec(tag string) *PluralSpec { tag = NormalizeTag(tag) subtag := tag for { if spec := pluralSpecs[subtag]; spec != nil { return spec } end := strings.LastIndex(subtag, "-") if end == -1 { return nil } subtag = subtag[:end] } }
[ "func", "GetPluralSpec", "(", "tag", "string", ")", "*", "PluralSpec", "{", "tag", "=", "NormalizeTag", "(", "tag", ")", "\n", "subtag", ":=", "tag", "\n", "for", "{", "if", "spec", ":=", "pluralSpecs", "[", "subtag", "]", ";", "spec", "!=", "nil", "...
// GetPluralSpec returns the PluralSpec that matches the longest prefix of tag. // It returns nil if no PluralSpec matches tag.
[ "GetPluralSpec", "returns", "the", "PluralSpec", "that", "matches", "the", "longest", "prefix", "of", "tag", ".", "It", "returns", "nil", "if", "no", "PluralSpec", "matches", "tag", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/pluralspec.go#L41-L54
train
nicksnyder/go-i18n
i18n/language/language.go
Parse
func Parse(src string) []*Language { var langs []*Language start := 0 for end, chr := range src { switch chr { case ',', ';', '.': tag := strings.TrimSpace(src[start:end]) if spec := GetPluralSpec(tag); spec != nil { langs = append(langs, &Language{NormalizeTag(tag), spec}) } start = end + 1 } ...
go
func Parse(src string) []*Language { var langs []*Language start := 0 for end, chr := range src { switch chr { case ',', ';', '.': tag := strings.TrimSpace(src[start:end]) if spec := GetPluralSpec(tag); spec != nil { langs = append(langs, &Language{NormalizeTag(tag), spec}) } start = end + 1 } ...
[ "func", "Parse", "(", "src", "string", ")", "[", "]", "*", "Language", "{", "var", "langs", "[", "]", "*", "Language", "\n", "start", ":=", "0", "\n", "for", "end", ",", "chr", ":=", "range", "src", "{", "switch", "chr", "{", "case", "','", ",", ...
// Parse returns a slice of supported languages found in src or nil if none are found. // It can parse language tags and Accept-Language headers.
[ "Parse", "returns", "a", "slice", "of", "supported", "languages", "found", "in", "src", "or", "nil", "if", "none", "are", "found", ".", "It", "can", "parse", "language", "tags", "and", "Accept", "-", "Language", "headers", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/language.go#L41-L65
train
nicksnyder/go-i18n
i18n/language/language.go
MustParse
func MustParse(src string) []*Language { langs := Parse(src) if len(langs) == 0 { panic(fmt.Errorf("unable to parse language from %q", src)) } return langs }
go
func MustParse(src string) []*Language { langs := Parse(src) if len(langs) == 0 { panic(fmt.Errorf("unable to parse language from %q", src)) } return langs }
[ "func", "MustParse", "(", "src", "string", ")", "[", "]", "*", "Language", "{", "langs", ":=", "Parse", "(", "src", ")", "\n", "if", "len", "(", "langs", ")", "==", "0", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "src", ")",...
// MustParse is similar to Parse except it panics instead of retuning a nil Language.
[ "MustParse", "is", "similar", "to", "Parse", "except", "it", "panics", "instead", "of", "retuning", "a", "nil", "Language", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/language.go#L80-L86
train
nicksnyder/go-i18n
i18n/language/language.go
Add
func Add(l *Language) { tag := NormalizeTag(l.Tag) pluralSpecs[tag] = l.PluralSpec }
go
func Add(l *Language) { tag := NormalizeTag(l.Tag) pluralSpecs[tag] = l.PluralSpec }
[ "func", "Add", "(", "l", "*", "Language", ")", "{", "tag", ":=", "NormalizeTag", "(", "l", ".", "Tag", ")", "\n", "pluralSpecs", "[", "tag", "]", "=", "l", ".", "PluralSpec", "\n", "}" ]
// Add adds support for a new language.
[ "Add", "adds", "support", "for", "a", "new", "language", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/language.go#L89-L92
train
nicksnyder/go-i18n
i18n/language/language.go
NormalizeTag
func NormalizeTag(tag string) string { tag = strings.ToLower(tag) return strings.Replace(tag, "_", "-", -1) }
go
func NormalizeTag(tag string) string { tag = strings.ToLower(tag) return strings.Replace(tag, "_", "-", -1) }
[ "func", "NormalizeTag", "(", "tag", "string", ")", "string", "{", "tag", "=", "strings", ".", "ToLower", "(", "tag", ")", "\n", "return", "strings", ".", "Replace", "(", "tag", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "}" ]
// NormalizeTag returns a language tag with all lower-case characters // and dashes "-" instead of underscores "_"
[ "NormalizeTag", "returns", "a", "language", "tag", "with", "all", "lower", "-", "case", "characters", "and", "dashes", "-", "instead", "of", "underscores", "_" ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/language.go#L96-L99
train
nicksnyder/go-i18n
i18n/i18n.go
TfuncAndLanguage
func TfuncAndLanguage(languageSource string, languageSources ...string) (TranslateFunc, *language.Language, error) { tfunc, lang, err := defaultBundle.TfuncAndLanguage(languageSource, languageSources...) return TranslateFunc(tfunc), lang, err }
go
func TfuncAndLanguage(languageSource string, languageSources ...string) (TranslateFunc, *language.Language, error) { tfunc, lang, err := defaultBundle.TfuncAndLanguage(languageSource, languageSources...) return TranslateFunc(tfunc), lang, err }
[ "func", "TfuncAndLanguage", "(", "languageSource", "string", ",", "languageSources", "...", "string", ")", "(", "TranslateFunc", ",", "*", "language", ".", "Language", ",", "error", ")", "{", "tfunc", ",", "lang", ",", "err", ":=", "defaultBundle", ".", "Tfu...
// TfuncAndLanguage is similar to Tfunc except it also returns the language which TranslateFunc is bound to.
[ "TfuncAndLanguage", "is", "similar", "to", "Tfunc", "except", "it", "also", "returns", "the", "language", "which", "TranslateFunc", "is", "bound", "to", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/i18n.go#L155-L158
train
nicksnyder/go-i18n
v2/i18n/bundle.go
RegisterUnmarshalFunc
func (b *Bundle) RegisterUnmarshalFunc(format string, unmarshalFunc UnmarshalFunc) { if b.unmarshalFuncs == nil { b.unmarshalFuncs = make(map[string]UnmarshalFunc) } b.unmarshalFuncs[format] = unmarshalFunc }
go
func (b *Bundle) RegisterUnmarshalFunc(format string, unmarshalFunc UnmarshalFunc) { if b.unmarshalFuncs == nil { b.unmarshalFuncs = make(map[string]UnmarshalFunc) } b.unmarshalFuncs[format] = unmarshalFunc }
[ "func", "(", "b", "*", "Bundle", ")", "RegisterUnmarshalFunc", "(", "format", "string", ",", "unmarshalFunc", "UnmarshalFunc", ")", "{", "if", "b", ".", "unmarshalFuncs", "==", "nil", "{", "b", ".", "unmarshalFuncs", "=", "make", "(", "map", "[", "string",...
// RegisterUnmarshalFunc registers an UnmarshalFunc for format.
[ "RegisterUnmarshalFunc", "registers", "an", "UnmarshalFunc", "for", "format", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/bundle.go#L40-L45
train
nicksnyder/go-i18n
v2/i18n/bundle.go
LoadMessageFile
func (b *Bundle) LoadMessageFile(path string) (*MessageFile, error) { buf, err := ioutil.ReadFile(path) if err != nil { return nil, err } return b.ParseMessageFileBytes(buf, path) }
go
func (b *Bundle) LoadMessageFile(path string) (*MessageFile, error) { buf, err := ioutil.ReadFile(path) if err != nil { return nil, err } return b.ParseMessageFileBytes(buf, path) }
[ "func", "(", "b", "*", "Bundle", ")", "LoadMessageFile", "(", "path", "string", ")", "(", "*", "MessageFile", ",", "error", ")", "{", "buf", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return...
// LoadMessageFile loads the bytes from path // and then calls ParseMessageFileBytes.
[ "LoadMessageFile", "loads", "the", "bytes", "from", "path", "and", "then", "calls", "ParseMessageFileBytes", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/bundle.go#L49-L55
train
nicksnyder/go-i18n
v2/i18n/bundle.go
MustLoadMessageFile
func (b *Bundle) MustLoadMessageFile(path string) { if _, err := b.LoadMessageFile(path); err != nil { panic(err) } }
go
func (b *Bundle) MustLoadMessageFile(path string) { if _, err := b.LoadMessageFile(path); err != nil { panic(err) } }
[ "func", "(", "b", "*", "Bundle", ")", "MustLoadMessageFile", "(", "path", "string", ")", "{", "if", "_", ",", "err", ":=", "b", ".", "LoadMessageFile", "(", "path", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}"...
// MustLoadMessageFile is similar to LoadTranslationFile // except it panics if an error happens.
[ "MustLoadMessageFile", "is", "similar", "to", "LoadTranslationFile", "except", "it", "panics", "if", "an", "error", "happens", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/bundle.go#L59-L63
train
nicksnyder/go-i18n
v2/i18n/bundle.go
ParseMessageFileBytes
func (b *Bundle) ParseMessageFileBytes(buf []byte, path string) (*MessageFile, error) { messageFile, err := internal.ParseMessageFileBytes(buf, path, b.unmarshalFuncs) if err != nil { return nil, err } if err := b.AddMessages(messageFile.Tag, messageFile.Messages...); err != nil { return nil, err } return mes...
go
func (b *Bundle) ParseMessageFileBytes(buf []byte, path string) (*MessageFile, error) { messageFile, err := internal.ParseMessageFileBytes(buf, path, b.unmarshalFuncs) if err != nil { return nil, err } if err := b.AddMessages(messageFile.Tag, messageFile.Messages...); err != nil { return nil, err } return mes...
[ "func", "(", "b", "*", "Bundle", ")", "ParseMessageFileBytes", "(", "buf", "[", "]", "byte", ",", "path", "string", ")", "(", "*", "MessageFile", ",", "error", ")", "{", "messageFile", ",", "err", ":=", "internal", ".", "ParseMessageFileBytes", "(", "buf...
// ParseMessageFileBytes parses the bytes in buf to add translations to the bundle. // // The format of the file is everything after the last ".". // // The language tag of the file is everything after the second to last "." or after the last path separator, but before the format.
[ "ParseMessageFileBytes", "parses", "the", "bytes", "in", "buf", "to", "add", "translations", "to", "the", "bundle", ".", "The", "format", "of", "the", "file", "is", "everything", "after", "the", "last", ".", ".", "The", "language", "tag", "of", "the", "fil...
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/bundle.go#L73-L82
train
nicksnyder/go-i18n
v2/i18n/bundle.go
MustParseMessageFileBytes
func (b *Bundle) MustParseMessageFileBytes(buf []byte, path string) { if _, err := b.ParseMessageFileBytes(buf, path); err != nil { panic(err) } }
go
func (b *Bundle) MustParseMessageFileBytes(buf []byte, path string) { if _, err := b.ParseMessageFileBytes(buf, path); err != nil { panic(err) } }
[ "func", "(", "b", "*", "Bundle", ")", "MustParseMessageFileBytes", "(", "buf", "[", "]", "byte", ",", "path", "string", ")", "{", "if", "_", ",", "err", ":=", "b", ".", "ParseMessageFileBytes", "(", "buf", ",", "path", ")", ";", "err", "!=", "nil", ...
// MustParseMessageFileBytes is similar to ParseMessageFileBytes // except it panics if an error happens.
[ "MustParseMessageFileBytes", "is", "similar", "to", "ParseMessageFileBytes", "except", "it", "panics", "if", "an", "error", "happens", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/bundle.go#L86-L90
train
nicksnyder/go-i18n
v2/i18n/bundle.go
AddMessages
func (b *Bundle) AddMessages(tag language.Tag, messages ...*Message) error { pluralRule := b.pluralRules.Rule(tag) if pluralRule == nil { return fmt.Errorf("no plural rule registered for %s", tag) } if b.messageTemplates == nil { b.messageTemplates = map[language.Tag]map[string]*internal.MessageTemplate{} } i...
go
func (b *Bundle) AddMessages(tag language.Tag, messages ...*Message) error { pluralRule := b.pluralRules.Rule(tag) if pluralRule == nil { return fmt.Errorf("no plural rule registered for %s", tag) } if b.messageTemplates == nil { b.messageTemplates = map[language.Tag]map[string]*internal.MessageTemplate{} } i...
[ "func", "(", "b", "*", "Bundle", ")", "AddMessages", "(", "tag", "language", ".", "Tag", ",", "messages", "...", "*", "Message", ")", "error", "{", "pluralRule", ":=", "b", ".", "pluralRules", ".", "Rule", "(", "tag", ")", "\n", "if", "pluralRule", "...
// AddMessages adds messages for a language. // It is useful if your messages are in a format not supported by ParseMessageFileBytes.
[ "AddMessages", "adds", "messages", "for", "a", "language", ".", "It", "is", "useful", "if", "your", "messages", "are", "in", "a", "format", "not", "supported", "by", "ParseMessageFileBytes", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/bundle.go#L94-L110
train
nicksnyder/go-i18n
v2/i18n/bundle.go
MustAddMessages
func (b *Bundle) MustAddMessages(tag language.Tag, messages ...*Message) { if err := b.AddMessages(tag, messages...); err != nil { panic(err) } }
go
func (b *Bundle) MustAddMessages(tag language.Tag, messages ...*Message) { if err := b.AddMessages(tag, messages...); err != nil { panic(err) } }
[ "func", "(", "b", "*", "Bundle", ")", "MustAddMessages", "(", "tag", "language", ".", "Tag", ",", "messages", "...", "*", "Message", ")", "{", "if", "err", ":=", "b", ".", "AddMessages", "(", "tag", ",", "messages", "...", ")", ";", "err", "!=", "n...
// MustAddMessages is similar to AddMessages except it panics if an error happens.
[ "MustAddMessages", "is", "similar", "to", "AddMessages", "except", "it", "panics", "if", "an", "error", "happens", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/i18n/bundle.go#L113-L117
train
nicksnyder/go-i18n
i18n/language/operands.go
NequalsAny
func (o *Operands) NequalsAny(any ...int64) bool { for _, i := range any { if o.I == i && o.T == 0 { return true } } return false }
go
func (o *Operands) NequalsAny(any ...int64) bool { for _, i := range any { if o.I == i && o.T == 0 { return true } } return false }
[ "func", "(", "o", "*", "Operands", ")", "NequalsAny", "(", "any", "...", "int64", ")", "bool", "{", "for", "_", ",", "i", ":=", "range", "any", "{", "if", "o", ".", "I", "==", "i", "&&", "o", ".", "T", "==", "0", "{", "return", "true", "\n", ...
// NequalsAny returns true if o represents an integer equal to any of the arguments.
[ "NequalsAny", "returns", "true", "if", "o", "represents", "an", "integer", "equal", "to", "any", "of", "the", "arguments", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/operands.go#L20-L27
train
nicksnyder/go-i18n
i18n/language/operands.go
NmodEqualsAny
func (o *Operands) NmodEqualsAny(mod int64, any ...int64) bool { modI := o.I % mod for _, i := range any { if modI == i && o.T == 0 { return true } } return false }
go
func (o *Operands) NmodEqualsAny(mod int64, any ...int64) bool { modI := o.I % mod for _, i := range any { if modI == i && o.T == 0 { return true } } return false }
[ "func", "(", "o", "*", "Operands", ")", "NmodEqualsAny", "(", "mod", "int64", ",", "any", "...", "int64", ")", "bool", "{", "modI", ":=", "o", ".", "I", "%", "mod", "\n", "for", "_", ",", "i", ":=", "range", "any", "{", "if", "modI", "==", "i",...
// NmodEqualsAny returns true if o represents an integer equal to any of the arguments modulo mod.
[ "NmodEqualsAny", "returns", "true", "if", "o", "represents", "an", "integer", "equal", "to", "any", "of", "the", "arguments", "modulo", "mod", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/operands.go#L30-L38
train
nicksnyder/go-i18n
v2/internal/message.go
NewMessage
func NewMessage(data interface{}) (*Message, error) { m := &Message{} if err := m.unmarshalInterface(data); err != nil { return nil, err } return m, nil }
go
func NewMessage(data interface{}) (*Message, error) { m := &Message{} if err := m.unmarshalInterface(data); err != nil { return nil, err } return m, nil }
[ "func", "NewMessage", "(", "data", "interface", "{", "}", ")", "(", "*", "Message", ",", "error", ")", "{", "m", ":=", "&", "Message", "{", "}", "\n", "if", "err", ":=", "m", ".", "unmarshalInterface", "(", "data", ")", ";", "err", "!=", "nil", "...
// NewMessage parses data and returns a new message.
[ "NewMessage", "parses", "data", "and", "returns", "a", "new", "message", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/internal/message.go#L47-L53
train
nicksnyder/go-i18n
v2/internal/message.go
MustNewMessage
func MustNewMessage(data interface{}) *Message { m, err := NewMessage(data) if err != nil { panic(err) } return m }
go
func MustNewMessage(data interface{}) *Message { m, err := NewMessage(data) if err != nil { panic(err) } return m }
[ "func", "MustNewMessage", "(", "data", "interface", "{", "}", ")", "*", "Message", "{", "m", ",", "err", ":=", "NewMessage", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "m", "\n", "}...
// MustNewMessage is similar to NewMessage except it panics if an error happens.
[ "MustNewMessage", "is", "similar", "to", "NewMessage", "except", "it", "panics", "if", "an", "error", "happens", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/internal/message.go#L56-L62
train
nicksnyder/go-i18n
v2/internal/message.go
unmarshalInterface
func (m *Message) unmarshalInterface(v interface{}) error { strdata, err := stringMap(v) if err != nil { return err } for k, v := range strdata { switch strings.ToLower(k) { case "id": m.ID = v case "description": m.Description = v case "hash": m.Hash = v case "leftdelim": m.LeftDelim = v ...
go
func (m *Message) unmarshalInterface(v interface{}) error { strdata, err := stringMap(v) if err != nil { return err } for k, v := range strdata { switch strings.ToLower(k) { case "id": m.ID = v case "description": m.Description = v case "hash": m.Hash = v case "leftdelim": m.LeftDelim = v ...
[ "func", "(", "m", "*", "Message", ")", "unmarshalInterface", "(", "v", "interface", "{", "}", ")", "error", "{", "strdata", ",", "err", ":=", "stringMap", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", ...
// unmarshalInterface unmarshals a message from data.
[ "unmarshalInterface", "unmarshals", "a", "message", "from", "data", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/internal/message.go#L65-L97
train
nicksnyder/go-i18n
v2/internal/message_template.go
NewMessageTemplate
func NewMessageTemplate(m *Message) *MessageTemplate { pluralTemplates := map[plural.Form]*Template{} setPluralTemplate(pluralTemplates, plural.Zero, m.Zero) setPluralTemplate(pluralTemplates, plural.One, m.One) setPluralTemplate(pluralTemplates, plural.Two, m.Two) setPluralTemplate(pluralTemplates, plural.Few, m....
go
func NewMessageTemplate(m *Message) *MessageTemplate { pluralTemplates := map[plural.Form]*Template{} setPluralTemplate(pluralTemplates, plural.Zero, m.Zero) setPluralTemplate(pluralTemplates, plural.One, m.One) setPluralTemplate(pluralTemplates, plural.Two, m.Two) setPluralTemplate(pluralTemplates, plural.Few, m....
[ "func", "NewMessageTemplate", "(", "m", "*", "Message", ")", "*", "MessageTemplate", "{", "pluralTemplates", ":=", "map", "[", "plural", ".", "Form", "]", "*", "Template", "{", "}", "\n", "setPluralTemplate", "(", "pluralTemplates", ",", "plural", ".", "Zero...
// NewMessageTemplate returns a new message template.
[ "NewMessageTemplate", "returns", "a", "new", "message", "template", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/internal/message_template.go#L19-L34
train
nicksnyder/go-i18n
v2/internal/message_template.go
Execute
func (mt *MessageTemplate) Execute(pluralForm plural.Form, data interface{}, funcs template.FuncMap) (string, error) { t := mt.PluralTemplates[pluralForm] if t == nil { return "", pluralFormNotFoundError{ pluralForm: pluralForm, messageID: mt.Message.ID, } } if err := t.parse(mt.LeftDelim, mt.RightDelim,...
go
func (mt *MessageTemplate) Execute(pluralForm plural.Form, data interface{}, funcs template.FuncMap) (string, error) { t := mt.PluralTemplates[pluralForm] if t == nil { return "", pluralFormNotFoundError{ pluralForm: pluralForm, messageID: mt.Message.ID, } } if err := t.parse(mt.LeftDelim, mt.RightDelim,...
[ "func", "(", "mt", "*", "MessageTemplate", ")", "Execute", "(", "pluralForm", "plural", ".", "Form", ",", "data", "interface", "{", "}", ",", "funcs", "template", ".", "FuncMap", ")", "(", "string", ",", "error", ")", "{", "t", ":=", "mt", ".", "Plur...
// Execute executes the template for the plural form and template data.
[ "Execute", "executes", "the", "template", "for", "the", "plural", "form", "and", "template", "data", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/internal/message_template.go#L52-L71
train
nicksnyder/go-i18n
v2/internal/plural/operands.go
NewOperands
func NewOperands(number interface{}) (*Operands, error) { switch number := number.(type) { case int: return newOperandsInt64(int64(number)), nil case int8: return newOperandsInt64(int64(number)), nil case int16: return newOperandsInt64(int64(number)), nil case int32: return newOperandsInt64(int64(number)),...
go
func NewOperands(number interface{}) (*Operands, error) { switch number := number.(type) { case int: return newOperandsInt64(int64(number)), nil case int8: return newOperandsInt64(int64(number)), nil case int16: return newOperandsInt64(int64(number)), nil case int32: return newOperandsInt64(int64(number)),...
[ "func", "NewOperands", "(", "number", "interface", "{", "}", ")", "(", "*", "Operands", ",", "error", ")", "{", "switch", "number", ":=", "number", ".", "(", "type", ")", "{", "case", "int", ":", "return", "newOperandsInt64", "(", "int64", "(", "number...
// NewOperands returns the operands for number.
[ "NewOperands", "returns", "the", "operands", "for", "number", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/internal/plural/operands.go#L52-L71
train
nicksnyder/go-i18n
i18n/language/codegen/xml.go
Name
func (pg *PluralGroup) Name() string { n := strings.Title(pg.Locales) return strings.Replace(n, " ", "", -1) }
go
func (pg *PluralGroup) Name() string { n := strings.Title(pg.Locales) return strings.Replace(n, " ", "", -1) }
[ "func", "(", "pg", "*", "PluralGroup", ")", "Name", "(", ")", "string", "{", "n", ":=", "strings", ".", "Title", "(", "pg", ".", "Locales", ")", "\n", "return", "strings", ".", "Replace", "(", "n", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1...
// Name returns a unique name for this plural group.
[ "Name", "returns", "a", "unique", "name", "for", "this", "plural", "group", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/codegen/xml.go#L23-L26
train
nicksnyder/go-i18n
i18n/language/codegen/xml.go
Condition
func (pr *PluralRule) Condition() string { i := strings.Index(pr.Rule, "@") return pr.Rule[:i] }
go
func (pr *PluralRule) Condition() string { i := strings.Index(pr.Rule, "@") return pr.Rule[:i] }
[ "func", "(", "pr", "*", "PluralRule", ")", "Condition", "(", ")", "string", "{", "i", ":=", "strings", ".", "Index", "(", "pr", ".", "Rule", ",", "\"", "\"", ")", "\n", "return", "pr", ".", "Rule", "[", ":", "i", "]", "\n", "}" ]
// Condition returns the condition where the PluralRule applies.
[ "Condition", "returns", "the", "condition", "where", "the", "PluralRule", "applies", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/codegen/xml.go#L45-L48
train
nicksnyder/go-i18n
i18n/language/codegen/xml.go
Examples
func (pr *PluralRule) Examples() (integer []string, decimal []string) { ex := strings.Replace(pr.Rule, ", …", "", -1) ddelim := "@decimal" if i := strings.Index(ex, ddelim); i > 0 { dex := strings.TrimSpace(ex[i+len(ddelim):]) decimal = strings.Split(dex, ", ") ex = ex[:i] } idelim := "@integer" if i := str...
go
func (pr *PluralRule) Examples() (integer []string, decimal []string) { ex := strings.Replace(pr.Rule, ", …", "", -1) ddelim := "@decimal" if i := strings.Index(ex, ddelim); i > 0 { dex := strings.TrimSpace(ex[i+len(ddelim):]) decimal = strings.Split(dex, ", ") ex = ex[:i] } idelim := "@integer" if i := str...
[ "func", "(", "pr", "*", "PluralRule", ")", "Examples", "(", ")", "(", "integer", "[", "]", "string", ",", "decimal", "[", "]", "string", ")", "{", "ex", ":=", "strings", ".", "Replace", "(", "pr", ".", "Rule", ",", "\"", " ", "\"", ",", " ", "-...
// Examples returns the integer and decimal exmaples for the PLuralRule.
[ "Examples", "returns", "the", "integer", "and", "decimal", "exmaples", "for", "the", "PLuralRule", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/codegen/xml.go#L51-L65
train
nicksnyder/go-i18n
v2/goi18n/merge_command.go
activeDst
func activeDst(src, dst *internal.MessageTemplate, pluralRule *plural.Rule) (active *internal.MessageTemplate, translateMessageTemplate *internal.MessageTemplate) { pluralForms := pluralRule.PluralForms if len(src.PluralTemplates) == 1 { pluralForms = map[plural.Form]struct{}{ plural.Other: {}, } } for plura...
go
func activeDst(src, dst *internal.MessageTemplate, pluralRule *plural.Rule) (active *internal.MessageTemplate, translateMessageTemplate *internal.MessageTemplate) { pluralForms := pluralRule.PluralForms if len(src.PluralTemplates) == 1 { pluralForms = map[plural.Form]struct{}{ plural.Other: {}, } } for plura...
[ "func", "activeDst", "(", "src", ",", "dst", "*", "internal", ".", "MessageTemplate", ",", "pluralRule", "*", "plural", ".", "Rule", ")", "(", "active", "*", "internal", ".", "MessageTemplate", ",", "translateMessageTemplate", "*", "internal", ".", "MessageTem...
// activeDst returns the active part of the dst and whether dst is a complete translation of src.
[ "activeDst", "returns", "the", "active", "part", "of", "the", "dst", "and", "whether", "dst", "is", "a", "complete", "translation", "of", "src", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/v2/goi18n/merge_command.go#L249-L285
train
nicksnyder/go-i18n
i18n/language/plural.go
NewPlural
func NewPlural(src string) (Plural, error) { switch src { case "zero": return Zero, nil case "one": return One, nil case "two": return Two, nil case "few": return Few, nil case "many": return Many, nil case "other": return Other, nil } return Invalid, fmt.Errorf("invalid plural category %s", src) }
go
func NewPlural(src string) (Plural, error) { switch src { case "zero": return Zero, nil case "one": return One, nil case "two": return Two, nil case "few": return Few, nil case "many": return Many, nil case "other": return Other, nil } return Invalid, fmt.Errorf("invalid plural category %s", src) }
[ "func", "NewPlural", "(", "src", "string", ")", "(", "Plural", ",", "error", ")", "{", "switch", "src", "{", "case", "\"", "\"", ":", "return", "Zero", ",", "nil", "\n", "case", "\"", "\"", ":", "return", "One", ",", "nil", "\n", "case", "\"", "\...
// NewPlural returns src as a Plural // or Invalid and a non-nil error if src is not a valid Plural.
[ "NewPlural", "returns", "src", "as", "a", "Plural", "or", "Invalid", "and", "a", "non", "-", "nil", "error", "if", "src", "is", "not", "a", "valid", "Plural", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/language/plural.go#L24-L40
train
nicksnyder/go-i18n
i18n/bundle/bundle.go
New
func New() *Bundle { return &Bundle{ translations: make(map[string]map[string]translation.Translation), fallbackTranslations: make(map[string]map[string]translation.Translation), } }
go
func New() *Bundle { return &Bundle{ translations: make(map[string]map[string]translation.Translation), fallbackTranslations: make(map[string]map[string]translation.Translation), } }
[ "func", "New", "(", ")", "*", "Bundle", "{", "return", "&", "Bundle", "{", "translations", ":", "make", "(", "map", "[", "string", "]", "map", "[", "string", "]", "translation", ".", "Translation", ")", ",", "fallbackTranslations", ":", "make", "(", "m...
// New returns an empty bundle.
[ "New", "returns", "an", "empty", "bundle", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/bundle/bundle.go#L35-L40
train
nicksnyder/go-i18n
i18n/bundle/bundle.go
MustLoadTranslationFile
func (b *Bundle) MustLoadTranslationFile(filename string) { if err := b.LoadTranslationFile(filename); err != nil { panic(err) } }
go
func (b *Bundle) MustLoadTranslationFile(filename string) { if err := b.LoadTranslationFile(filename); err != nil { panic(err) } }
[ "func", "(", "b", "*", "Bundle", ")", "MustLoadTranslationFile", "(", "filename", "string", ")", "{", "if", "err", ":=", "b", ".", "LoadTranslationFile", "(", "filename", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "...
// MustLoadTranslationFile is similar to LoadTranslationFile // except it panics if an error happens.
[ "MustLoadTranslationFile", "is", "similar", "to", "LoadTranslationFile", "except", "it", "panics", "if", "an", "error", "happens", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/bundle/bundle.go#L44-L48
train
nicksnyder/go-i18n
i18n/bundle/bundle.go
deleteLeadingComments
func deleteLeadingComments(ext string, buf []byte) []byte { if ext != ".yaml" { return buf } for { buf = bytes.TrimLeftFunc(buf, unicode.IsSpace) if buf[0] == '#' { buf = deleteLine(buf) } else { break } } return buf }
go
func deleteLeadingComments(ext string, buf []byte) []byte { if ext != ".yaml" { return buf } for { buf = bytes.TrimLeftFunc(buf, unicode.IsSpace) if buf[0] == '#' { buf = deleteLine(buf) } else { break } } return buf }
[ "func", "deleteLeadingComments", "(", "ext", "string", ",", "buf", "[", "]", "byte", ")", "[", "]", "byte", "{", "if", "ext", "!=", "\"", "\"", "{", "return", "buf", "\n", "}", "\n\n", "for", "{", "buf", "=", "bytes", ".", "TrimLeftFunc", "(", "buf...
// deleteLeadingComments deletes leading newlines and comments in buf. // It only works for ext == ".yaml".
[ "deleteLeadingComments", "deletes", "leading", "newlines", "and", "comments", "in", "buf", ".", "It", "only", "works", "for", "ext", "==", ".", "yaml", "." ]
b2843f1401bcdec49ebbd5b729689ee36ea1e65a
https://github.com/nicksnyder/go-i18n/blob/b2843f1401bcdec49ebbd5b729689ee36ea1e65a/i18n/bundle/bundle.go#L129-L144
train