repo
stringlengths
5
67
path
stringlengths
4
218
func_name
stringlengths
0
151
original_string
stringlengths
52
373k
language
stringclasses
6 values
code
stringlengths
52
373k
code_tokens
listlengths
10
512
docstring
stringlengths
3
47.2k
docstring_tokens
listlengths
3
234
sha
stringlengths
40
40
url
stringlengths
85
339
partition
stringclasses
3 values
pilosa/pilosa
iterator.go
Seek
func (itr *sliceIterator) Seek(bseek, pseek uint64) { for i := 0; i < itr.n; i++ { rowID := itr.rowIDs[i] columnID := itr.columnIDs[i] if (bseek == rowID && pseek <= columnID) || bseek < rowID { itr.i = i return } } // Seek to the end of the slice if all values are less than seek pair. itr.i = itr.n }
go
func (itr *sliceIterator) Seek(bseek, pseek uint64) { for i := 0; i < itr.n; i++ { rowID := itr.rowIDs[i] columnID := itr.columnIDs[i] if (bseek == rowID && pseek <= columnID) || bseek < rowID { itr.i = i return } } // Seek to the end of the slice if all values are less than seek pair. itr.i = itr.n }
[ "func", "(", "itr", "*", "sliceIterator", ")", "Seek", "(", "bseek", ",", "pseek", "uint64", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "itr", ".", "n", ";", "i", "++", "{", "rowID", ":=", "itr", ".", "rowIDs", "[", "i", "]", "\n", "colu...
// Seek moves the cursor to a given pair. // If the pair is not found, the iterator seeks to the next pair.
[ "Seek", "moves", "the", "cursor", "to", "a", "given", "pair", ".", "If", "the", "pair", "is", "not", "found", "the", "iterator", "seeks", "to", "the", "next", "pair", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/iterator.go#L146-L159
train
pilosa/pilosa
encoding/proto/proto.go
Marshal
func (Serializer) Marshal(m pilosa.Message) ([]byte, error) { pm := encodeToProto(m) if pm == nil { return nil, errors.New("passed invalid pilosa.Message") } buf, err := proto.Marshal(pm) return buf, errors.Wrap(err, "marshalling") }
go
func (Serializer) Marshal(m pilosa.Message) ([]byte, error) { pm := encodeToProto(m) if pm == nil { return nil, errors.New("passed invalid pilosa.Message") } buf, err := proto.Marshal(pm) return buf, errors.Wrap(err, "marshalling") }
[ "func", "(", "Serializer", ")", "Marshal", "(", "m", "pilosa", ".", "Message", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "pm", ":=", "encodeToProto", "(", "m", ")", "\n", "if", "pm", "==", "nil", "{", "return", "nil", ",", "errors", "."...
// Marshal turns pilosa messages into protobuf serialized bytes.
[ "Marshal", "turns", "pilosa", "messages", "into", "protobuf", "serialized", "bytes", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/encoding/proto/proto.go#L32-L39
train
pilosa/pilosa
encoding/proto/proto.go
encodeNodes
func encodeNodes(a []*pilosa.Node) []*internal.Node { other := make([]*internal.Node, len(a)) for i := range a { other[i] = encodeNode(a[i]) } return other }
go
func encodeNodes(a []*pilosa.Node) []*internal.Node { other := make([]*internal.Node, len(a)) for i := range a { other[i] = encodeNode(a[i]) } return other }
[ "func", "encodeNodes", "(", "a", "[", "]", "*", "pilosa", ".", "Node", ")", "[", "]", "*", "internal", ".", "Node", "{", "other", ":=", "make", "(", "[", "]", "*", "internal", ".", "Node", ",", "len", "(", "a", ")", ")", "\n", "for", "i", ":=...
// encodeNodes converts a slice of Nodes into its internal representation.
[ "encodeNodes", "converts", "a", "slice", "of", "Nodes", "into", "its", "internal", "representation", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/encoding/proto/proto.go#L541-L547
train
pilosa/pilosa
encoding/proto/proto.go
encodeNode
func encodeNode(n *pilosa.Node) *internal.Node { return &internal.Node{ ID: n.ID, URI: encodeURI(n.URI), IsCoordinator: n.IsCoordinator, State: n.State, } }
go
func encodeNode(n *pilosa.Node) *internal.Node { return &internal.Node{ ID: n.ID, URI: encodeURI(n.URI), IsCoordinator: n.IsCoordinator, State: n.State, } }
[ "func", "encodeNode", "(", "n", "*", "pilosa", ".", "Node", ")", "*", "internal", ".", "Node", "{", "return", "&", "internal", ".", "Node", "{", "ID", ":", "n", ".", "ID", ",", "URI", ":", "encodeURI", "(", "n", ".", "URI", ")", ",", "IsCoordinat...
// encodeNode converts a Node into its internal representation.
[ "encodeNode", "converts", "a", "Node", "into", "its", "internal", "representation", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/encoding/proto/proto.go#L550-L557
train
pilosa/pilosa
encoding/proto/proto.go
decodeRow
func decodeRow(pr *internal.Row) *pilosa.Row { if pr == nil { return nil } r := pilosa.NewRow() r.Attrs = decodeAttrs(pr.Attrs) r.Keys = pr.Keys for _, v := range pr.Columns { r.SetBit(v) } return r }
go
func decodeRow(pr *internal.Row) *pilosa.Row { if pr == nil { return nil } r := pilosa.NewRow() r.Attrs = decodeAttrs(pr.Attrs) r.Keys = pr.Keys for _, v := range pr.Columns { r.SetBit(v) } return r }
[ "func", "decodeRow", "(", "pr", "*", "internal", ".", "Row", ")", "*", "pilosa", ".", "Row", "{", "if", "pr", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "r", ":=", "pilosa", ".", "NewRow", "(", ")", "\n", "r", ".", "Attrs", "=", "decod...
// DecodeRow converts r from its internal representation.
[ "DecodeRow", "converts", "r", "from", "its", "internal", "representation", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/encoding/proto/proto.go#L1084-L1096
train
pilosa/pilosa
row.go
NewRow
func NewRow(columns ...uint64) *Row { r := &Row{} for _, i := range columns { r.SetBit(i) } return r }
go
func NewRow(columns ...uint64) *Row { r := &Row{} for _, i := range columns { r.SetBit(i) } return r }
[ "func", "NewRow", "(", "columns", "...", "uint64", ")", "*", "Row", "{", "r", ":=", "&", "Row", "{", "}", "\n", "for", "_", ",", "i", ":=", "range", "columns", "{", "r", ".", "SetBit", "(", "i", ")", "\n", "}", "\n", "return", "r", "\n", "}" ...
// NewRow returns a new instance of Row.
[ "NewRow", "returns", "a", "new", "instance", "of", "Row", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L38-L44
train
pilosa/pilosa
row.go
IsEmpty
func (r *Row) IsEmpty() bool { if len(r.segments) == 0 { return true } for i := range r.segments { if r.segments[i].n > 0 { return false } } return true }
go
func (r *Row) IsEmpty() bool { if len(r.segments) == 0 { return true } for i := range r.segments { if r.segments[i].n > 0 { return false } } return true }
[ "func", "(", "r", "*", "Row", ")", "IsEmpty", "(", ")", "bool", "{", "if", "len", "(", "r", ".", "segments", ")", "==", "0", "{", "return", "true", "\n", "}", "\n", "for", "i", ":=", "range", "r", ".", "segments", "{", "if", "r", ".", "segmen...
// IsEmpty returns true if the row doesn't contain any set bits.
[ "IsEmpty", "returns", "true", "if", "the", "row", "doesn", "t", "contain", "any", "set", "bits", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L47-L58
train
pilosa/pilosa
row.go
Merge
func (r *Row) Merge(other *Row) { var segments []rowSegment itr := newMergeSegmentIterator(r.segments, other.segments) for s0, s1 := itr.next(); s0 != nil || s1 != nil; s0, s1 = itr.next() { // Use the other row's data if segment is missing. if s0 == nil { segments = append(segments, *s1) continue } else if s1 == nil { segments = append(segments, *s0) continue } // Otherwise merge. s0.Merge(s1) segments = append(segments, *s0) } r.segments = segments r.invalidateCount() }
go
func (r *Row) Merge(other *Row) { var segments []rowSegment itr := newMergeSegmentIterator(r.segments, other.segments) for s0, s1 := itr.next(); s0 != nil || s1 != nil; s0, s1 = itr.next() { // Use the other row's data if segment is missing. if s0 == nil { segments = append(segments, *s1) continue } else if s1 == nil { segments = append(segments, *s0) continue } // Otherwise merge. s0.Merge(s1) segments = append(segments, *s0) } r.segments = segments r.invalidateCount() }
[ "func", "(", "r", "*", "Row", ")", "Merge", "(", "other", "*", "Row", ")", "{", "var", "segments", "[", "]", "rowSegment", "\n", "itr", ":=", "newMergeSegmentIterator", "(", "r", ".", "segments", ",", "other", ".", "segments", ")", "\n", "for", "s0",...
// Merge merges data from other into r.
[ "Merge", "merges", "data", "from", "other", "into", "r", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L61-L82
train
pilosa/pilosa
row.go
intersectionCount
func (r *Row) intersectionCount(other *Row) uint64 { var n uint64 itr := newMergeSegmentIterator(r.segments, other.segments) for s0, s1 := itr.next(); s0 != nil || s1 != nil; s0, s1 = itr.next() { // Ignore non-overlapping segments. if s0 == nil || s1 == nil { continue } n += s0.IntersectionCount(s1) } return n }
go
func (r *Row) intersectionCount(other *Row) uint64 { var n uint64 itr := newMergeSegmentIterator(r.segments, other.segments) for s0, s1 := itr.next(); s0 != nil || s1 != nil; s0, s1 = itr.next() { // Ignore non-overlapping segments. if s0 == nil || s1 == nil { continue } n += s0.IntersectionCount(s1) } return n }
[ "func", "(", "r", "*", "Row", ")", "intersectionCount", "(", "other", "*", "Row", ")", "uint64", "{", "var", "n", "uint64", "\n", "itr", ":=", "newMergeSegmentIterator", "(", "r", ".", "segments", ",", "other", ".", "segments", ")", "\n", "for", "s0", ...
// intersectionCount returns the number of intersections between r and other.
[ "intersectionCount", "returns", "the", "number", "of", "intersections", "between", "r", "and", "other", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L85-L98
train
pilosa/pilosa
row.go
Shift
func (r *Row) Shift(n int64) (*Row, error) { if n < 0 { return nil, errors.New("cannot shift by negative values") } else if n == 0 { return r, nil } work := r var segments []rowSegment for i := int64(0); i < n; i++ { segments = segments[:0] for _, segment := range work.segments { shifted, err := segment.Shift() if err != nil { return nil, errors.Wrap(err, "shifting row segment") } segments = append(segments, *shifted) } work = &Row{segments: segments} } return work, nil }
go
func (r *Row) Shift(n int64) (*Row, error) { if n < 0 { return nil, errors.New("cannot shift by negative values") } else if n == 0 { return r, nil } work := r var segments []rowSegment for i := int64(0); i < n; i++ { segments = segments[:0] for _, segment := range work.segments { shifted, err := segment.Shift() if err != nil { return nil, errors.Wrap(err, "shifting row segment") } segments = append(segments, *shifted) } work = &Row{segments: segments} } return work, nil }
[ "func", "(", "r", "*", "Row", ")", "Shift", "(", "n", "int64", ")", "(", "*", "Row", ",", "error", ")", "{", "if", "n", "<", "0", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"cannot shift by negative values\"", ")", "\n", "}", "else", ...
// Shift returns the bitwise shift of r by n bits. // Currently only positive shift values are supported.
[ "Shift", "returns", "the", "bitwise", "shift", "of", "r", "by", "n", "bits", ".", "Currently", "only", "positive", "shift", "values", "are", "supported", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L174-L196
train
pilosa/pilosa
row.go
clearBit
func (r *Row) clearBit(i uint64) (changed bool) { // nolint: unparam s := r.segment(i / ShardWidth) if s == nil { return false } return s.ClearBit(i) }
go
func (r *Row) clearBit(i uint64) (changed bool) { // nolint: unparam s := r.segment(i / ShardWidth) if s == nil { return false } return s.ClearBit(i) }
[ "func", "(", "r", "*", "Row", ")", "clearBit", "(", "i", "uint64", ")", "(", "changed", "bool", ")", "{", "s", ":=", "r", ".", "segment", "(", "i", "/", "ShardWidth", ")", "\n", "if", "s", "==", "nil", "{", "return", "false", "\n", "}", "\n", ...
// 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#L204-L210
train
pilosa/pilosa
row.go
segment
func (r *Row) segment(shard uint64) *rowSegment { if i := sort.Search(len(r.segments), func(i int) bool { return r.segments[i].shard >= shard }); i < len(r.segments) && r.segments[i].shard == shard { return &r.segments[i] } return nil }
go
func (r *Row) segment(shard uint64) *rowSegment { if i := sort.Search(len(r.segments), func(i int) bool { return r.segments[i].shard >= shard }); i < len(r.segments) && r.segments[i].shard == shard { return &r.segments[i] } return nil }
[ "func", "(", "r", "*", "Row", ")", "segment", "(", "shard", "uint64", ")", "*", "rowSegment", "{", "if", "i", ":=", "sort", ".", "Search", "(", "len", "(", "r", ".", "segments", ")", ",", "func", "(", "i", "int", ")", "bool", "{", "return", "r"...
// segment returns a segment for a given shard. // Returns nil if segment does not exist.
[ "segment", "returns", "a", "segment", "for", "a", "given", "shard", ".", "Returns", "nil", "if", "segment", "does", "not", "exist", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L219-L226
train
pilosa/pilosa
row.go
invalidateCount
func (r *Row) invalidateCount() { for i := range r.segments { r.segments[i].InvalidateCount() } }
go
func (r *Row) invalidateCount() { for i := range r.segments { r.segments[i].InvalidateCount() } }
[ "func", "(", "r", "*", "Row", ")", "invalidateCount", "(", ")", "{", "for", "i", ":=", "range", "r", ".", "segments", "{", "r", ".", "segments", "[", "i", "]", ".", "InvalidateCount", "(", ")", "\n", "}", "\n", "}" ]
// invalidateCount updates the cached count in the row.
[ "invalidateCount", "updates", "the", "cached", "count", "in", "the", "row", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L253-L257
train
pilosa/pilosa
row.go
Count
func (r *Row) Count() uint64 { var n uint64 for i := range r.segments { n += r.segments[i].Count() } return n }
go
func (r *Row) Count() uint64 { var n uint64 for i := range r.segments { n += r.segments[i].Count() } return n }
[ "func", "(", "r", "*", "Row", ")", "Count", "(", ")", "uint64", "{", "var", "n", "uint64", "\n", "for", "i", ":=", "range", "r", ".", "segments", "{", "n", "+=", "r", ".", "segments", "[", "i", "]", ".", "Count", "(", ")", "\n", "}", "\n", ...
// Count returns the number of columns in the row.
[ "Count", "returns", "the", "number", "of", "columns", "in", "the", "row", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L260-L266
train
pilosa/pilosa
row.go
MarshalJSON
func (r *Row) MarshalJSON() ([]byte, error) { var o struct { Attrs map[string]interface{} `json:"attrs"` Columns []uint64 `json:"columns"` Keys []string `json:"keys,omitempty"` } o.Columns = r.Columns() o.Keys = r.Keys o.Attrs = r.Attrs if o.Attrs == nil { o.Attrs = make(map[string]interface{}) } return json.Marshal(&o) }
go
func (r *Row) MarshalJSON() ([]byte, error) { var o struct { Attrs map[string]interface{} `json:"attrs"` Columns []uint64 `json:"columns"` Keys []string `json:"keys,omitempty"` } o.Columns = r.Columns() o.Keys = r.Keys o.Attrs = r.Attrs if o.Attrs == nil { o.Attrs = make(map[string]interface{}) } return json.Marshal(&o) }
[ "func", "(", "r", "*", "Row", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "o", "struct", "{", "Attrs", "map", "[", "string", "]", "interface", "{", "}", "`json:\"attrs\"`", "\n", "Columns", "[", "]", "uint64"...
// MarshalJSON returns a JSON-encoded byte slice of r.
[ "MarshalJSON", "returns", "a", "JSON", "-", "encoded", "byte", "slice", "of", "r", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L269-L284
train
pilosa/pilosa
row.go
Columns
func (r *Row) Columns() []uint64 { a := make([]uint64, 0, r.Count()) for i := range r.segments { a = append(a, r.segments[i].Columns()...) } return a }
go
func (r *Row) Columns() []uint64 { a := make([]uint64, 0, r.Count()) for i := range r.segments { a = append(a, r.segments[i].Columns()...) } return a }
[ "func", "(", "r", "*", "Row", ")", "Columns", "(", ")", "[", "]", "uint64", "{", "a", ":=", "make", "(", "[", "]", "uint64", ",", "0", ",", "r", ".", "Count", "(", ")", ")", "\n", "for", "i", ":=", "range", "r", ".", "segments", "{", "a", ...
// Columns returns the columns in r as a slice of ints.
[ "Columns", "returns", "the", "columns", "in", "r", "as", "a", "slice", "of", "ints", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L287-L293
train
pilosa/pilosa
row.go
Merge
func (s *rowSegment) Merge(other *rowSegment) { s.ensureWritable() itr := other.data.Iterator() for v, eof := itr.Next(); !eof; v, eof = itr.Next() { s.SetBit(v) } }
go
func (s *rowSegment) Merge(other *rowSegment) { s.ensureWritable() itr := other.data.Iterator() for v, eof := itr.Next(); !eof; v, eof = itr.Next() { s.SetBit(v) } }
[ "func", "(", "s", "*", "rowSegment", ")", "Merge", "(", "other", "*", "rowSegment", ")", "{", "s", ".", "ensureWritable", "(", ")", "\n", "itr", ":=", "other", ".", "data", ".", "Iterator", "(", ")", "\n", "for", "v", ",", "eof", ":=", "itr", "."...
// Merge adds chunks from other to s. // Chunks in s are overwritten if they exist in other.
[ "Merge", "adds", "chunks", "from", "other", "to", "s", ".", "Chunks", "in", "s", "are", "overwritten", "if", "they", "exist", "in", "other", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L314-L321
train
pilosa/pilosa
row.go
IntersectionCount
func (s *rowSegment) IntersectionCount(other *rowSegment) uint64 { return s.data.IntersectionCount(&other.data) }
go
func (s *rowSegment) IntersectionCount(other *rowSegment) uint64 { return s.data.IntersectionCount(&other.data) }
[ "func", "(", "s", "*", "rowSegment", ")", "IntersectionCount", "(", "other", "*", "rowSegment", ")", "uint64", "{", "return", "s", ".", "data", ".", "IntersectionCount", "(", "&", "other", ".", "data", ")", "\n", "}" ]
// IntersectionCount returns the number of intersections between s and other.
[ "IntersectionCount", "returns", "the", "number", "of", "intersections", "between", "s", "and", "other", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L324-L326
train
pilosa/pilosa
row.go
Intersect
func (s *rowSegment) Intersect(other *rowSegment) *rowSegment { data := s.data.Intersect(&other.data) return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), } }
go
func (s *rowSegment) Intersect(other *rowSegment) *rowSegment { data := s.data.Intersect(&other.data) return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), } }
[ "func", "(", "s", "*", "rowSegment", ")", "Intersect", "(", "other", "*", "rowSegment", ")", "*", "rowSegment", "{", "data", ":=", "s", ".", "data", ".", "Intersect", "(", "&", "other", ".", "data", ")", "\n", "return", "&", "rowSegment", "{", "data"...
// Intersect returns the itersection of s and other.
[ "Intersect", "returns", "the", "itersection", "of", "s", "and", "other", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L329-L337
train
pilosa/pilosa
row.go
Union
func (s *rowSegment) Union(other *rowSegment) *rowSegment { data := s.data.Union(&other.data) return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), } }
go
func (s *rowSegment) Union(other *rowSegment) *rowSegment { data := s.data.Union(&other.data) return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), } }
[ "func", "(", "s", "*", "rowSegment", ")", "Union", "(", "other", "*", "rowSegment", ")", "*", "rowSegment", "{", "data", ":=", "s", ".", "data", ".", "Union", "(", "&", "other", ".", "data", ")", "\n", "return", "&", "rowSegment", "{", "data", ":",...
// Union returns the bitwise union of s and other.
[ "Union", "returns", "the", "bitwise", "union", "of", "s", "and", "other", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L340-L348
train
pilosa/pilosa
row.go
Difference
func (s *rowSegment) Difference(other *rowSegment) *rowSegment { data := s.data.Difference(&other.data) return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), } }
go
func (s *rowSegment) Difference(other *rowSegment) *rowSegment { data := s.data.Difference(&other.data) return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), } }
[ "func", "(", "s", "*", "rowSegment", ")", "Difference", "(", "other", "*", "rowSegment", ")", "*", "rowSegment", "{", "data", ":=", "s", ".", "data", ".", "Difference", "(", "&", "other", ".", "data", ")", "\n", "return", "&", "rowSegment", "{", "dat...
// Difference returns the diff of s and other.
[ "Difference", "returns", "the", "diff", "of", "s", "and", "other", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L351-L359
train
pilosa/pilosa
row.go
Xor
func (s *rowSegment) Xor(other *rowSegment) *rowSegment { data := s.data.Xor(&other.data) return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), } }
go
func (s *rowSegment) Xor(other *rowSegment) *rowSegment { data := s.data.Xor(&other.data) return &rowSegment{ data: *data, shard: s.shard, n: data.Count(), } }
[ "func", "(", "s", "*", "rowSegment", ")", "Xor", "(", "other", "*", "rowSegment", ")", "*", "rowSegment", "{", "data", ":=", "s", ".", "data", ".", "Xor", "(", "&", "other", ".", "data", ")", "\n", "return", "&", "rowSegment", "{", "data", ":", "...
// Xor returns the xor of s and other.
[ "Xor", "returns", "the", "xor", "of", "s", "and", "other", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/row.go#L362-L370
train
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", ")", "{", "data", ",", "err", ":=", "s", ".", "data", ".", "Shift", "(", "1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "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", "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", "s", ".", "data", "=", "*", "s", ".", "data", ".", "Clone", "(", ")", "\n", "s", ".", "writable", "=", "true"...
// 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 == nil { itr.a0 = itr.a0[1:] return } // Otherwise determine which is first. if s0.shard < s1.shard { itr.a0 = itr.a0[1:] return s0, nil } else if s0.shard > s1.shard { itr.a1 = itr.a1[1:] return s1, nil } // Return both if shards are equal. itr.a0, itr.a1 = itr.a0[1:], itr.a1[1:] return s0, 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 == nil { itr.a0 = itr.a0[1:] return } // Otherwise determine which is first. if s0.shard < s1.shard { itr.a0 = itr.a0[1:] return s0, nil } else if s0.shard > s1.shard { itr.a1 = itr.a1[1:] return s1, nil } // Return both if shards are equal. itr.a0, itr.a1 = itr.a0[1:], itr.a1[1:] return s0, s1 }
[ "func", "(", "itr", "*", "mergeSegmentIterator", ")", "next", "(", ")", "(", "s0", ",", "s1", "*", "rowSegment", ")", "{", "if", "len", "(", "itr", ".", "a0", ")", ">", "0", "{", "s0", "=", "&", "itr", ".", "a0", "[", "0", "]", "\n", "}", "...
// 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", "...
// 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 ImageSizeType `json:"imageSize,omitempty"` ImageBackgroundColor string `json:"imageBackgroundColor,omitempty"` Title string `json:"title,omitempty"` Text string `json:"text"` Actions []TemplateAction `json:"actions"` }{ Type: TemplateTypeButtons, ThumbnailImageURL: t.ThumbnailImageURL, ImageAspectRatio: t.ImageAspectRatio, ImageSize: t.ImageSize, ImageBackgroundColor: t.ImageBackgroundColor, Title: t.Title, Text: t.Text, Actions: t.Actions, }) }
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 ImageSizeType `json:"imageSize,omitempty"` ImageBackgroundColor string `json:"imageBackgroundColor,omitempty"` Title string `json:"title,omitempty"` Text string `json:"text"` Actions []TemplateAction `json:"actions"` }{ Type: TemplateTypeButtons, ThumbnailImageURL: t.ThumbnailImageURL, ImageAspectRatio: t.ImageAspectRatio, ImageSize: t.ImageSize, ImageBackgroundColor: t.ImageBackgroundColor, Title: t.Title, Text: t.Text, Actions: t.Actions, }) }
[ "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 `json:"imageSize,omitempty"` }{ Type: TemplateTypeCarousel, Columns: t.Columns, ImageAspectRatio: t.ImageAspectRatio, ImageSize: t.ImageSize, }) }
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 `json:"imageSize,omitempty"` }{ Type: TemplateTypeCarousel, Columns: t.Columns, ImageAspectRatio: t.ImageAspectRatio, ImageSize: t.ImageSize, }) }
[ "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: channelToken, httpClient: http.DefaultClient, } for _, option := range options { err := option(c) if err != nil { return nil, err } } if c.endpointBase == nil { u, err := url.ParseRequestURI(APIEndpointBase) if err != nil { return nil, err } c.endpointBase = u } return c, nil }
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: channelToken, httpClient: http.DefaultClient, } for _, option := range options { err := option(c) if err != nil { return nil, err } } if c.endpointBase == nil { u, err := url.ParseRequestURI(APIEndpointBase) if err != nil { return nil, err } c.endpointBase = u } return c, nil }
[ "func", "New", "(", "channelSecret", ",", "channelToken", "string", ",", "options", "...", "ClientOption", ")", "(", "*", "Client", ",", "error", ")", "{", "if", "channelSecret", "==", "\"\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"miss...
// 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, content := range raw.Contents { components[i] = content.Component } c.Contents = components return nil }
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, content := range raw.Contents { components[i] = content.Component } c.Contents = components return nil }
[ "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,omitempty"` Body *BoxComponent `json:"body,omitempty"` Footer *BoxComponent `json:"footer,omitempty"` Styles *BubbleStyle `json:"styles,omitempty"` }{ Type: FlexContainerTypeBubble, Direction: c.Direction, Header: c.Header, Hero: c.Hero, Body: c.Body, Footer: c.Footer, Styles: c.Styles, }) }
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,omitempty"` Body *BoxComponent `json:"body,omitempty"` Footer *BoxComponent `json:"footer,omitempty"` Styles *BubbleStyle `json:"styles,omitempty"` }{ Type: FlexContainerTypeBubble, Direction: c.Direction, Header: c.Header, Hero: c.Hero, Body: c.Body, Footer: c.Footer, Styles: c.Styles, }) }
[ "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 FlexComponentSpacingType `json:"spacing,omitempty"` Margin FlexComponentMarginType `json:"margin,omitempty"` }{ Type: FlexComponentTypeBox, Layout: c.Layout, Contents: c.Contents, Flex: c.Flex, Spacing: c.Spacing, Margin: c.Margin, }) }
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 FlexComponentSpacingType `json:"spacing,omitempty"` Margin FlexComponentMarginType `json:"margin,omitempty"` }{ Type: FlexComponentTypeBox, Layout: c.Layout, Contents: c.Contents, Flex: c.Flex, Spacing: c.Spacing, Margin: c.Margin, }) }
[ "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 FlexButtonHeightType `json:"height,omitempty"` Style FlexButtonStyleType `json:"style,omitempty"` Color string `json:"color,omitempty"` Gravity FlexComponentGravityType `json:"gravity,omitempty"` }{ Type: FlexComponentTypeButton, Action: c.Action, Flex: c.Flex, Margin: c.Margin, Height: c.Height, Style: c.Style, Color: c.Color, Gravity: c.Gravity, }) }
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 FlexButtonHeightType `json:"height,omitempty"` Style FlexButtonStyleType `json:"style,omitempty"` Color string `json:"color,omitempty"` Gravity FlexComponentGravityType `json:"gravity,omitempty"` }{ Type: FlexComponentTypeButton, Action: c.Action, Flex: c.Flex, Margin: c.Margin, Height: c.Height, Style: c.Style, Color: c.Color, Gravity: c.Gravity, }) }
[ "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"` AspectRatio FlexIconAspectRatioType `json:"aspectRatio,omitempty"` }{ Type: FlexComponentTypeIcon, URL: c.URL, Margin: c.Margin, Size: c.Size, AspectRatio: c.AspectRatio, }) }
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"` AspectRatio FlexIconAspectRatioType `json:"aspectRatio,omitempty"` }{ Type: FlexComponentTypeIcon, URL: c.URL, Margin: c.Margin, Size: c.Size, AspectRatio: c.AspectRatio, }) }
[ "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:"margin,omitempty"` Align FlexComponentAlignType `json:"align,omitempty"` Gravity FlexComponentGravityType `json:"gravity,omitempty"` Size FlexImageSizeType `json:"size,omitempty"` AspectRatio FlexImageAspectRatioType `json:"aspectRatio,omitempty"` AspectMode FlexImageAspectModeType `json:"aspectMode,omitempty"` BackgroundColor string `json:"backgroundColor,omitempty"` Action TemplateAction `json:"action,omitempty"` }{ Type: FlexComponentTypeImage, URL: c.URL, Flex: c.Flex, Margin: c.Margin, Align: c.Align, Gravity: c.Gravity, Size: c.Size, AspectRatio: c.AspectRatio, AspectMode: c.AspectMode, BackgroundColor: c.BackgroundColor, Action: c.Action, }) }
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:"margin,omitempty"` Align FlexComponentAlignType `json:"align,omitempty"` Gravity FlexComponentGravityType `json:"gravity,omitempty"` Size FlexImageSizeType `json:"size,omitempty"` AspectRatio FlexImageAspectRatioType `json:"aspectRatio,omitempty"` AspectMode FlexImageAspectModeType `json:"aspectMode,omitempty"` BackgroundColor string `json:"backgroundColor,omitempty"` Action TemplateAction `json:"action,omitempty"` }{ Type: FlexComponentTypeImage, URL: c.URL, Flex: c.Flex, Margin: c.Margin, Align: c.Align, Gravity: c.Gravity, Size: c.Size, AspectRatio: c.AspectRatio, AspectMode: c.AspectMode, BackgroundColor: c.BackgroundColor, Action: c.Action, }) }
[ "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, Color: c.Color, }) }
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, Color: c.Color, }) }
[ "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 FlexTextSizeType `json:"size,omitempty"` Align FlexComponentAlignType `json:"align,omitempty"` Gravity FlexComponentGravityType `json:"gravity,omitempty"` Wrap bool `json:"wrap,omitempty"` Weight FlexTextWeightType `json:"weight,omitempty"` Color string `json:"color,omitempty"` Action TemplateAction `json:"action,omitempty"` }{ Type: FlexComponentTypeText, Text: c.Text, Flex: c.Flex, Margin: c.Margin, Size: c.Size, Align: c.Align, Gravity: c.Gravity, Wrap: c.Wrap, Weight: c.Weight, Color: c.Color, Action: c.Action, }) }
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 FlexTextSizeType `json:"size,omitempty"` Align FlexComponentAlignType `json:"align,omitempty"` Gravity FlexComponentGravityType `json:"gravity,omitempty"` Wrap bool `json:"wrap,omitempty"` Weight FlexTextWeightType `json:"weight,omitempty"` Color string `json:"color,omitempty"` Action TemplateAction `json:"action,omitempty"` }{ Type: FlexComponentTypeText, Text: c.Text, Flex: c.Flex, Margin: c.Margin, Size: c.Size, Align: c.Align, Gravity: c.Gravity, Wrap: c.Wrap, Weight: c.Weight, Color: c.Color, Action: c.Action, }) }
[ "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 = &rawBeaconEvent{ Hwid: e.Beacon.Hwid, Type: e.Beacon.Type, DM: hex.EncodeToString(e.Beacon.DeviceMessage), } } if e.AccountLink != nil { raw.AccountLink = &rawAccountLinkEvent{ Result: e.AccountLink.Result, Nonce: e.AccountLink.Nonce, } } switch e.Type { case EventTypeMemberJoined: raw.Joined = &rawMemberEvent{ Members: e.Members, } case EventTypeMemberLeft: raw.Left = &rawMemberEvent{ Members: e.Members, } case EventTypeThings: raw.Things = &Things{ DeviceID: e.Things.DeviceID, Type: e.Things.Type, } } switch m := e.Message.(type) { case *TextMessage: raw.Message = &rawEventMessage{ Type: MessageTypeText, ID: m.ID, Text: m.Text, } case *ImageMessage: raw.Message = &rawEventMessage{ Type: MessageTypeImage, ID: m.ID, } case *VideoMessage: raw.Message = &rawEventMessage{ Type: MessageTypeVideo, ID: m.ID, } case *AudioMessage: raw.Message = &rawEventMessage{ Type: MessageTypeAudio, ID: m.ID, Duration: m.Duration, } case *FileMessage: raw.Message = &rawEventMessage{ Type: MessageTypeFile, ID: m.ID, FileName: m.FileName, FileSize: m.FileSize, } case *LocationMessage: raw.Message = &rawEventMessage{ Type: MessageTypeLocation, ID: m.ID, Title: m.Title, Address: m.Address, Latitude: m.Latitude, Longitude: m.Longitude, } case *StickerMessage: raw.Message = &rawEventMessage{ Type: MessageTypeSticker, ID: m.ID, PackageID: m.PackageID, StickerID: m.StickerID, } } return json.Marshal(&raw) }
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 = &rawBeaconEvent{ Hwid: e.Beacon.Hwid, Type: e.Beacon.Type, DM: hex.EncodeToString(e.Beacon.DeviceMessage), } } if e.AccountLink != nil { raw.AccountLink = &rawAccountLinkEvent{ Result: e.AccountLink.Result, Nonce: e.AccountLink.Nonce, } } switch e.Type { case EventTypeMemberJoined: raw.Joined = &rawMemberEvent{ Members: e.Members, } case EventTypeMemberLeft: raw.Left = &rawMemberEvent{ Members: e.Members, } case EventTypeThings: raw.Things = &Things{ DeviceID: e.Things.DeviceID, Type: e.Things.Type, } } switch m := e.Message.(type) { case *TextMessage: raw.Message = &rawEventMessage{ Type: MessageTypeText, ID: m.ID, Text: m.Text, } case *ImageMessage: raw.Message = &rawEventMessage{ Type: MessageTypeImage, ID: m.ID, } case *VideoMessage: raw.Message = &rawEventMessage{ Type: MessageTypeVideo, ID: m.ID, } case *AudioMessage: raw.Message = &rawEventMessage{ Type: MessageTypeAudio, ID: m.ID, Duration: m.Duration, } case *FileMessage: raw.Message = &rawEventMessage{ Type: MessageTypeFile, ID: m.ID, FileName: m.FileName, FileSize: m.FileSize, } case *LocationMessage: raw.Message = &rawEventMessage{ Type: MessageTypeLocation, ID: m.ID, Title: m.Title, Address: m.Address, Latitude: m.Latitude, Longitude: m.Longitude, } case *StickerMessage: raw.Message = &rawEventMessage{ Type: MessageTypeSticker, ID: m.ID, PackageID: m.PackageID, StickerID: m.StickerID, } } return json.Marshal(&raw) }
[ "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)*nanosecPerMillisec).UTC() e.Source = rawEvent.Source switch rawEvent.Type { case EventTypeMessage: switch rawEvent.Message.Type { case MessageTypeText: e.Message = &TextMessage{ ID: rawEvent.Message.ID, Text: rawEvent.Message.Text, } case MessageTypeImage: e.Message = &ImageMessage{ ID: rawEvent.Message.ID, } case MessageTypeVideo: e.Message = &VideoMessage{ ID: rawEvent.Message.ID, } case MessageTypeAudio: e.Message = &AudioMessage{ ID: rawEvent.Message.ID, Duration: rawEvent.Message.Duration, } case MessageTypeFile: e.Message = &FileMessage{ ID: rawEvent.Message.ID, FileName: rawEvent.Message.FileName, FileSize: rawEvent.Message.FileSize, } case MessageTypeLocation: e.Message = &LocationMessage{ ID: rawEvent.Message.ID, Title: rawEvent.Message.Title, Address: rawEvent.Message.Address, Latitude: rawEvent.Message.Latitude, Longitude: rawEvent.Message.Longitude, } case MessageTypeSticker: e.Message = &StickerMessage{ ID: rawEvent.Message.ID, PackageID: rawEvent.Message.PackageID, StickerID: rawEvent.Message.StickerID, } } case EventTypePostback: e.Postback = rawEvent.Postback case EventTypeBeacon: var deviceMessage []byte deviceMessage, err = hex.DecodeString(rawEvent.Beacon.DM) if err != nil { return } e.Beacon = &Beacon{ Hwid: rawEvent.Beacon.Hwid, Type: rawEvent.Beacon.Type, DeviceMessage: deviceMessage, } case EventTypeAccountLink: e.AccountLink = &AccountLink{ Result: rawEvent.AccountLink.Result, Nonce: rawEvent.AccountLink.Nonce, } case EventTypeMemberJoined: e.Members = rawEvent.Joined.Members case EventTypeMemberLeft: e.Members = rawEvent.Left.Members case EventTypeThings: e.Things = new(Things) e.Things.Type = rawEvent.Things.Type e.Things.DeviceID = rawEvent.Things.DeviceID } return }
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)*nanosecPerMillisec).UTC() e.Source = rawEvent.Source switch rawEvent.Type { case EventTypeMessage: switch rawEvent.Message.Type { case MessageTypeText: e.Message = &TextMessage{ ID: rawEvent.Message.ID, Text: rawEvent.Message.Text, } case MessageTypeImage: e.Message = &ImageMessage{ ID: rawEvent.Message.ID, } case MessageTypeVideo: e.Message = &VideoMessage{ ID: rawEvent.Message.ID, } case MessageTypeAudio: e.Message = &AudioMessage{ ID: rawEvent.Message.ID, Duration: rawEvent.Message.Duration, } case MessageTypeFile: e.Message = &FileMessage{ ID: rawEvent.Message.ID, FileName: rawEvent.Message.FileName, FileSize: rawEvent.Message.FileSize, } case MessageTypeLocation: e.Message = &LocationMessage{ ID: rawEvent.Message.ID, Title: rawEvent.Message.Title, Address: rawEvent.Message.Address, Latitude: rawEvent.Message.Latitude, Longitude: rawEvent.Message.Longitude, } case MessageTypeSticker: e.Message = &StickerMessage{ ID: rawEvent.Message.ID, PackageID: rawEvent.Message.PackageID, StickerID: rawEvent.Message.StickerID, } } case EventTypePostback: e.Postback = rawEvent.Postback case EventTypeBeacon: var deviceMessage []byte deviceMessage, err = hex.DecodeString(rawEvent.Beacon.DM) if err != nil { return } e.Beacon = &Beacon{ Hwid: rawEvent.Beacon.Hwid, Type: rawEvent.Beacon.Type, DeviceMessage: deviceMessage, } case EventTypeAccountLink: e.AccountLink = &AccountLink{ Result: rawEvent.AccountLink.Result, Nonce: rawEvent.AccountLink.Nonce, } case EventTypeMemberJoined: e.Members = rawEvent.Joined.Members case EventTypeMemberLeft: e.Members = rawEvent.Left.Members case EventTypeThings: e.Things = new(Things) e.Things.Type = rawEvent.Things.Type e.Things.DeviceID = rawEvent.Things.DeviceID } return }
[ "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: a.URI, AltURI: a.AltURI, }) }
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: a.URI, AltURI: a.AltURI, }) }
[ "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"` }{ Type: ActionTypePostback, Label: a.Label, Data: a.Data, Text: a.Text, DisplayText: a.DisplayText, }) }
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"` }{ Type: ActionTypePostback, Label: a.Label, Data: a.Data, Text: a.Text, DisplayText: a.DisplayText, }) }
[ "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:"max,omitempty"` Min string `json:"min,omitempty"` }{ Type: ActionTypeDatetimePicker, Label: a.Label, Data: a.Data, Mode: a.Mode, Initial: a.Initial, Max: a.Max, Min: a.Min, }) }
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:"max,omitempty"` Min string `json:"min,omitempty"` }{ Type: ActionTypeDatetimePicker, Label: a.Label, Data: a.Data, Mode: a.Mode, Initial: a.Initial, Max: a.Max, Min: a.Min, }) }
[ "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.quickReplyitems, }) }
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.quickReplyitems, }) }
[ "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:"quickReply,omitempty"` }{ Type: MessageTypeImage, OriginalContentURL: m.OriginalContentURL, PreviewImageURL: m.PreviewImageURL, QuickReply: m.quickReplyitems, }) }
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:"quickReply,omitempty"` }{ Type: MessageTypeImage, OriginalContentURL: m.OriginalContentURL, PreviewImageURL: m.PreviewImageURL, QuickReply: m.quickReplyitems, }) }
[ "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:"quickReply,omitempty"` }{ Type: MessageTypeVideo, OriginalContentURL: m.OriginalContentURL, PreviewImageURL: m.PreviewImageURL, QuickReply: m.quickReplyitems, }) }
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:"quickReply,omitempty"` }{ Type: MessageTypeVideo, OriginalContentURL: m.OriginalContentURL, PreviewImageURL: m.PreviewImageURL, QuickReply: m.quickReplyitems, }) }
[ "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,omitempty"` }{ Type: MessageTypeAudio, OriginalContentURL: m.OriginalContentURL, Duration: m.Duration, QuickReply: m.quickReplyitems, }) }
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,omitempty"` }{ Type: MessageTypeAudio, OriginalContentURL: m.OriginalContentURL, Duration: m.Duration, QuickReply: m.quickReplyitems, }) }
[ "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"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeLocation, Title: m.Title, Address: m.Address, Latitude: m.Latitude, Longitude: m.Longitude, QuickReply: m.quickReplyitems, }) }
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"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeLocation, Title: m.Title, Address: m.Address, Latitude: m.Latitude, Longitude: m.Longitude, QuickReply: m.quickReplyitems, }) }
[ "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: MessageTypeSticker, PackageID: m.PackageID, StickerID: m.StickerID, QuickReply: m.quickReplyitems, }) }
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: MessageTypeSticker, PackageID: m.PackageID, StickerID: m.StickerID, QuickReply: m.quickReplyitems, }) }
[ "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: MessageTypeTemplate, AltText: m.AltText, Template: m.Template, QuickReply: m.quickReplyitems, }) }
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: MessageTypeTemplate, AltText: m.AltText, Template: m.Template, QuickReply: m.quickReplyitems, }) }
[ "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"` Video *ImagemapVideo `json:"video,omitempty"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeImagemap, BaseURL: m.BaseURL, AltText: m.AltText, BaseSize: m.BaseSize, Actions: m.Actions, Video: m.Video, QuickReply: m.quickReplyitems, }) }
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"` Video *ImagemapVideo `json:"video,omitempty"` QuickReply *QuickReplyItems `json:"quickReply,omitempty"` }{ Type: MessageTypeImagemap, BaseURL: m.BaseURL, AltText: m.AltText, BaseSize: m.BaseSize, Actions: m.Actions, Video: m.Video, QuickReply: m.quickReplyitems, }) }
[ "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, AltText: m.AltText, Contents: m.Contents, QuickReply: m.quickReplyitems, }) }
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, AltText: m.AltText, Contents: m.Contents, QuickReply: m.quickReplyitems, }) }
[ "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: channelToken, } return h, nil }
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: channelToken, } return h, nil }
[ "func", "New", "(", "channelSecret", ",", "channelToken", "string", ")", "(", "*", "WebhookHandler", ",", "error", ")", "{", "if", "channelSecret", "==", "\"\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"missing channel secret\"", ")", "\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} } messageID = lc.DefaultMessage.ID } var operands *plural.Operands templateData := lc.TemplateData if lc.PluralCount != nil { var err error operands, err = plural.NewOperands(lc.PluralCount) if err != nil { return "", language.Und, &invalidPluralCountErr{messageID: messageID, pluralCount: lc.PluralCount, err: err} } if templateData == nil { templateData = map[string]interface{}{ "PluralCount": lc.PluralCount, } } } tag, template := l.getTemplate(messageID, lc.DefaultMessage) if template == nil { return "", language.Und, &MessageNotFoundErr{messageID: messageID} } pluralForm := l.pluralForm(tag, operands) if pluralForm == plural.Invalid { return "", language.Und, &pluralizeErr{messageID: messageID, tag: tag} } msg, err := template.Execute(pluralForm, templateData, lc.Funcs) if err != nil { return "", language.Und, err } return msg, tag, nil }
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} } messageID = lc.DefaultMessage.ID } var operands *plural.Operands templateData := lc.TemplateData if lc.PluralCount != nil { var err error operands, err = plural.NewOperands(lc.PluralCount) if err != nil { return "", language.Und, &invalidPluralCountErr{messageID: messageID, pluralCount: lc.PluralCount, err: err} } if templateData == nil { templateData = map[string]interface{}{ "PluralCount": lc.PluralCount, } } } tag, template := l.getTemplate(messageID, lc.DefaultMessage) if template == nil { return "", language.Und, &MessageNotFoundErr{messageID: messageID} } pluralForm := l.pluralForm(tag, operands) if pluralForm == plural.Invalid { return "", language.Und, &pluralizeErr{messageID: messageID, tag: tag} } msg, err := template.Execute(pluralForm, templateData, lc.Funcs) if err != nil { return "", language.Und, err } return msg, tag, nil }
[ "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 } unmarshalFunc := unmarshalFuncs[messageFile.Format] if unmarshalFunc == nil { if messageFile.Format == "json" { unmarshalFunc = json.Unmarshal } else { return nil, fmt.Errorf("no unmarshaler registered for %s", messageFile.Format) } } var err error var raw interface{} if err = unmarshalFunc(buf, &raw); err != nil { return nil, err } if messageFile.Messages, err = recGetMessages(raw, isMessage(raw), true); err != nil { return nil, err } return messageFile, nil }
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 } unmarshalFunc := unmarshalFuncs[messageFile.Format] if unmarshalFunc == nil { if messageFile.Format == "json" { unmarshalFunc = json.Unmarshal } else { return nil, fmt.Errorf("no unmarshaler registered for %s", messageFile.Format) } } var err error var raw interface{} if err = unmarshalFunc(buf, &raw); err != nil { return nil, err } if messageFile.Messages, err = recGetMessages(raw, isMessage(raw), true); err != nil { return nil, err } return messageFile, nil }
[ "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]interface{}: if isMapMessage { m, err := NewMessage(data) return []*Message{m}, err } messages = make([]*Message, 0, len(data)) for id, data := range data { // recursively scan map items messages, err = addChildMessages(id, data, messages) if err != nil { return nil, err } } case map[interface{}]interface{}: if isMapMessage { m, err := NewMessage(data) return []*Message{m}, err } messages = make([]*Message, 0, len(data)) for id, data := range data { strid, ok := id.(string) if !ok { return nil, fmt.Errorf("expected key to be string but got %#v", id) } // recursively scan map items messages, err = addChildMessages(strid, data, messages) if err != nil { return nil, err } } case []interface{}: // Backward compatibility for v1 file format. messages = make([]*Message, 0, len(data)) for _, data := range data { // recursively scan slice items childMessages, err := recGetMessages(data, isMessage(data), false) if err != nil { return nil, err } messages = append(messages, childMessages...) } default: return nil, fmt.Errorf("unsupported file format %T", raw) } return messages, nil }
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]interface{}: if isMapMessage { m, err := NewMessage(data) return []*Message{m}, err } messages = make([]*Message, 0, len(data)) for id, data := range data { // recursively scan map items messages, err = addChildMessages(id, data, messages) if err != nil { return nil, err } } case map[interface{}]interface{}: if isMapMessage { m, err := NewMessage(data) return []*Message{m}, err } messages = make([]*Message, 0, len(data)) for id, data := range data { strid, ok := id.(string) if !ok { return nil, fmt.Errorf("expected key to be string but got %#v", id) } // recursively scan map items messages, err = addChildMessages(strid, data, messages) if err != nil { return nil, err } } case []interface{}: // Backward compatibility for v1 file format. messages = make([]*Message, 0, len(data)) for _, data := range data { // recursively scan slice items childMessages, err := recGetMessages(data, isMessage(data), false) if err != nil { return nil, err } messages = append(messages, childMessages...) } default: return nil, fmt.Errorf("unsupported file format %T", raw) } return messages, nil }
[ "func", "recGetMessages", "(", "raw", "interface", "{", "}", ",", "isMapMessage", ",", "isInitialCall", "bool", ")", "(", "[", "]", "*", "Message", ",", "error", ")", "{", "var", "messages", "[", "]", "*", "Message", "\n", "var", "err", "error", "\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 } } if start > 0 { tag := strings.TrimSpace(src[start:]) if spec := GetPluralSpec(tag); spec != nil { langs = append(langs, &Language{NormalizeTag(tag), spec}) } return dedupe(langs) } if spec := GetPluralSpec(src); spec != nil { langs = append(langs, &Language{NormalizeTag(src), spec}) } return langs }
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 } } if start > 0 { tag := strings.TrimSpace(src[start:]) if spec := GetPluralSpec(tag); spec != nil { langs = append(langs, &Language{NormalizeTag(tag), spec}) } return dedupe(langs) } if spec := GetPluralSpec(src); spec != nil { langs = append(langs, &Language{NormalizeTag(src), spec}) } return langs }
[ "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", "(", "\"unable to parse language from %q\...
// 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