[Groonga-commit] groonga/grnci at 9b55be2 [master] Update comments

Back to archive index

Susumu Yata null+****@clear*****
Thu Feb 11 11:12:08 JST 2016


Susumu Yata	2016-02-11 11:12:08 +0900 (Thu, 11 Feb 2016)

  New Revision: 9b55be2cecd7b0e25c64e68123024254af00da4e
  https://github.com/groonga/grnci/commit/9b55be2cecd7b0e25c64e68123024254af00da4e

  Message:
    Update comments

  Modified files:
    grnci.go

  Modified: grnci.go (+21 -5)
===================================================================
--- grnci.go    2016-02-11 10:45:08 +0900 (e10a840)
+++ grnci.go    2016-02-11 11:12:08 +0900 (c586c30)
@@ -1,6 +1,9 @@
 // Package grnci operates Groonga DBs via Groonga commands.
 //
 // This package is experimental and supports only a subset of Groonga commands.
+//
+// See http://groonga.org/docs/reference/command.html for details about Groonga
+// commands.
 package grnci
 
 // #cgo pkg-config: groonga
@@ -944,19 +947,30 @@ func (val *Geo) writeTo(buf *bytes.Buffer) error {
 	return err
 }
 
-// MarshalJSON() returns JSON bytes.
+// MarshalJSON() encodes Time to JSON bytes.
+//
+// Time is represented by the number of seconds elapsed since the Unix Epoch in
+// JSON.
+//
+// http://groonga.org/docs/tutorial/data.html#date-and-time-type
 func (val Time) MarshalJSON() ([]byte, error) {
 	sec := int64(val) / 1000000
 	usec := int64(val) % 1000000
 	return []byte(fmt.Sprintf("%d.%06d", sec, usec)), nil
 }
 
-// MarshalJSON() returns JSON bytes.
+// MarshalJSON() encodes Geo to JSON bytes.
+//
+// Geo is represented by a string with the format "Lat,Long" in JSON.
+//
+// http://groonga.org/docs/tutorial/data.html#longitude-and-latitude-types
 func (val Geo) MarshalJSON() ([]byte, error) {
 	return []byte(fmt.Sprintf("\"%d,%d\"", val.Lat, val.Long)), nil
 }
 
-// UnmarshalJSON() decodes JSON bytes.
+// UnmarshalJSON() decodes JSON bytes to Time.
+//
+// http://groonga.org/docs/tutorial/data.html#date-and-time-type
 func (val *Time) UnmarshalJSON(data []byte) error {
 	str := string(data)
 	idx := strings.IndexByte(str, '.')
@@ -980,7 +994,9 @@ func (val *Time) UnmarshalJSON(data []byte) error {
 	return nil
 }
 
-// UnmarshalJSON() decodes JSON bytes.
+// UnmarshalJSON() decodes JSON bytes to Geo.
+//
+// http://groonga.org/docs/tutorial/data.html#longitude-and-latitude-types
 func (val *Geo) UnmarshalJSON(data []byte) error {
 	str := string(data)
 	if (len(str) < 2) || (str[0] != '"') || (str[len(str)-1] != '"') {
@@ -1235,7 +1251,7 @@ type LoadOptions struct {
 	IfExists string // --ifexists
 }
 
-// NewLoadOptions() returns default options.
+// NewLoadOptions() returns the default options.
 func NewLoadOptions() *LoadOptions {
 	options := new(LoadOptions)
 	return options
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index