kintone

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2022 License: BSD-2-Clause Imports: 18 Imported by: 0

README

Go binding for kintone API

WARNING This binding (and kintone itself) is not mature. Backward compatibility may not be kept. Use with caution. You have been warned.

This package provides a convenient interface for Go language to access kintone with its official REST API (en, ja).

kintone is our B2B cloud service; you can create great web apps instantly with kintone!

Version

0.3.0

License

This software is licensed under the BSD 2-clause license.

Coverage

  • kintone application API
  • kintone space API
  • user management API

Usage

To import this package:

import "github.com/kintone/go-kintone"

Visit the docs on godoc.org.

Copyright(c) Cybozu, Inc.

Documentation

Overview

Package kintone provides interfaces for kintone REST API.

See https://developer.kintone.io for API specs.

import (
	"log"

	"github.com/kintone/go-kintone"
)
...
app := &kintone.App{
	Domain:   "example.cybozu.com",
	User:     "user1",
	Password: "password",
	AppId:    25,
}

To retrieve 3 records from a kintone app (id=25):

records, err := app.GetRecords(nil, "limit 3")
if err != nil {
	log.Fatal(err)
}
// use records

To retrieve 10 latest comments in record (id=3) from a kintone app (id=25)

var offset uint64 = 0
var limit uint64 = 10
comments, err := app.GetRecordComments(3, "desc", offset, limit)
if err != nil {
	log.Fatal(err)
}
// use comments

To retrieve oldest 10 comments and skips the first 30 comments in record (id=3) from a kintone app (id=25)

var offset uint64 = 30
var limit uint64 = 10
comments, err := app.GetRecordComments(3, "asc", offset, limit)
if err != nil {
	log.Fatal(err)
}
// use comments

To add comments into record (id=3) from a kintone app (id=25)

mentionMemberCybozu := &ObjMention{Code: "cybozu", Type: kintone.ConstCommentMentionTypeUser}
mentionGroupAdmin := &ObjMention{Code: "Administrators", Type: kintone.ConstCommentMentionTypeGroup}
mentionDepartmentAdmin := &ObjMention{Code: "Admin", Type: ConstCommentMentionTypeDepartment}

var cmt Comment
cmt.Text = "Test comment 222"
cmt.Mentions = []*ObjMention{mentionGroupAdmin, mentionMemberCybozu, mentionDepartmentAdmin}
cmtID, err := app.AddRecordComment(3, &cmt)
if err != nil {
	log.Fatal(err)
}
// use comments id

To remove comments (id=12) in the record (id=3) from a kintone app (id=25)

err := app.DeleteComment(3, 12)

if err != nil {
	log.Fatal(err)
}

Index

Constants

View Source
const (
	NAME            = "go-kintone"
	VERSION         = "0.3.0"
	DEFAULT_TIMEOUT = time.Second * 600 // Default value for App.Timeout
)
View Source
const (
	ConstCommentMentionTypeGroup      = "GROUP"
	ConstCommentMentionTypeDepartment = "ORGANIZATION"
	ConstCommentMentionTypeUser       = "USER"
)
View Source
const (
	FT_SINGLE_LINE_TEXT = "SINGLE_LINE_TEXT"
	FT_MULTI_LINE_TEXT  = "MULTI_LINE_TEXT"
	FT_RICH_TEXT        = "RICH_TEXT"
	FT_DECIMAL          = "NUMBER"
	FT_CALC             = "CALC"
	FT_CHECK_BOX        = "CHECK_BOX"
	FT_RADIO            = "RADIO_BUTTON"
	FT_SINGLE_SELECT    = "DROP_DOWN"
	FT_MULTI_SELECT     = "MULTI_SELECT"
	FT_FILE             = "FILE"
	FT_LINK             = "LINK"
	FT_DATE             = "DATE"
	FT_TIME             = "TIME"
	FT_DATETIME         = "DATETIME"
	FT_USER             = "USER_SELECT"
	FT_ORGANIZATION     = "ORGANIZATION_SELECT"
	FT_GROUP            = "GROUP_SELECT"
	FT_CATEGORY         = "CATEGORY"
	FT_STATUS           = "STATUS"
	FT_ASSIGNEE         = "STATUS_ASSIGNEE"
	FT_RECNUM           = "RECORD_NUMBER"
	FT_CREATOR          = "CREATOR"
	FT_CTIME            = "CREATED_TIME"
	FT_MODIFIER         = "MODIFIER"
	FT_MTIME            = "UPDATED_TIME"
	FT_SUBTABLE         = "SUBTABLE"
	FT_ID               = "__ID__"
	FT_REVISION         = "__REVISION__"
)

Field type identifiers.

Variables

View Source
var (
	ErrTimeout         = errors.New("Timeout")
	ErrInvalidResponse = errors.New("Invalid Response")
	ErrTooMany         = errors.New("Too many records")
)

Library internal errors.

Functions

func IsBuiltinField

func IsBuiltinField(o interface{}) bool

IsBuiltinField returns true if the field is a built-in field.

Types

type App

type App struct {
	Domain       string        // domain name.  ex: "sample.cybozu.com", "sample.kintone.com", "sample.cybozu.cn"
	User         string        // User account for API.
	Password     string        // User password for API.
	AppId        uint64        // application ID.
	Client       *http.Client  // Specialized client.
	Timeout      time.Duration // Timeout for API responses.
	ApiToken     string        // API token.
	GuestSpaceId uint64        // guest space ID.
	// contains filtered or unexported fields
}

App provides kintone application API client.

You need to provide Domain, User, Password, and AppId. You can also use an API token instead of user/password. If you require specialized client settings, for instance need to specify a client certificate, proxy settings, or are using Google AppEngine, you can build an *http.Client instance and supply it to Client.

ex: Google AppEngine

import (
	"appengine"
	"appengine/urlfetch"
	"github.com/kintone/go-kintone"
	"net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
	c := appengine.NewContext(r)
	app := &kintone.App{Client: urlfetch.Client(c)}
	...
}

ex: proxy

import (
	"net/http"
	"net/url"
	"github.com/kintone/go-kintone"
)

func main() {
	proxyURL, _ := url.Parse("https://proxy.example.com")
	transport := &http.Transport{Proxy: http.ProxyURL(proxyURL)}
	client := &http.Client{Transport: transport}
	app := &kintone.App{Client: client}
	...
}

Errors returned by the methods of App may be one of *AppError, ErrTimeout, ErrInvalidResponse, or ErrTooMany.

func (*App) AddRecord

func (app *App) AddRecord(rec *Record) (id string, err error)

AddRecord adds a new record.

If successful, the record ID of the new record is returned.

func (*App) AddRecordComment

func (app *App) AddRecordComment(recordId uint64, comment *Comment) (id string, err error)

AddRecordComment post some comments by record ID.

If successful, it returns the target record ID.

func (*App) AddRecords

func (app *App) AddRecords(recs []*Record) ([]string, error)

AddRecords adds new records.

Up to 100 records can be added at once. If successful, a list of record IDs is returned.

func (*App) CreateCursor added in v0.3.0

func (app *App) CreateCursor(fields []string, query string, size uint64) (*Cursor, error)

CreateCursor return the meta data of the Cursor in this application

func (*App) DeleteComment

func (app *App) DeleteComment(recordId uint64, commentId uint64) error

DeleteComment - Delete single comment

func (*App) DeleteCursor added in v0.3.0

func (app *App) DeleteCursor(id string) error

DeleteCursor - Delete cursor by id

func (*App) DeleteRecords

func (app *App) DeleteRecords(ids []uint64) error

DeleteRecords deletes multiple records.

Up to 100 records can be deleted at once.

func (*App) Download

func (app *App) Download(fileKey string) (*FileData, error)

Download fetches an attached file contents.

fileKey should be obtained from FileField (= []File).

func (*App) Fields

func (app *App) Fields() (map[string]*FieldInfo, error)

Fields returns the meta data of the fields in this application.

If successful, a mapping between field codes and FieldInfo is returned.

func (*App) GetAllRecords

func (app *App) GetAllRecords(fields []string) ([]*Record, error)

GetAllRecords fetches all records.

If fields is nil, all fields are retrieved.

func (*App) GetBasicAuthPassword added in v0.1.1

func (app *App) GetBasicAuthPassword() string

GetBasicAuthPassword return password string for basic authentication

func (*App) GetBasicAuthUser added in v0.1.1

func (app *App) GetBasicAuthUser() string

GetBasicAuthUser return username string for basic authentication

func (*App) GetProcess added in v0.2.0

func (app *App) GetProcess(lang string) (process *Process, err error)

GetProcess retrieves the process management settings This method can only be used when App is initialized with password authentication lang must be one of default, en, zh, ja, user

func (*App) GetRecord

func (app *App) GetRecord(id uint64) (*Record, error)

GetRecord fetches a record.

func (*App) GetRecordComments

func (app *App) GetRecordComments(recordID uint64, order string, offset, limit uint64) ([]Comment, error)

GetRecordComments get comment list by record ID.

It returns comment array.

func (*App) GetRecords

func (app *App) GetRecords(fields []string, query string) ([]*Record, error)

GetRecords fetches records matching given conditions.

This method can retrieve up to 100 records at once. To retrieve more records, you need to call GetRecords with increasing "offset" query parameter until the number of records retrieved becomes less than 100.

If fields is nil, all fields are retrieved. See API specs how to construct query strings.

func (*App) GetRecordsByCursor added in v0.3.0

func (app *App) GetRecordsByCursor(id string) (*GetRecordsCursorResponse, error)

Using Cursor Id to get all records GetRecordsByCursor return the meta data of the Record in this application

func (*App) GetUserAgentHeader added in v0.1.1

func (app *App) GetUserAgentHeader() string

GetUserAgentHeader get user-agent header string

func (*App) HasBasicAuth added in v0.1.1

func (app *App) HasBasicAuth() bool

HasBasicAuth indicate authentication is basic or not

func (*App) NewRequest added in v0.3.0

func (app *App) NewRequest(method, url string, body io.Reader) (*http.Request, error)

NewRequest create a request connect to kintone api.

func (*App) SetBasicAuth

func (app *App) SetBasicAuth(user, password string)

SetBasicAuth enables use of HTTP basic authentication for access to kintone.

func (*App) SetUserAgentHeader added in v0.1.1

func (app *App) SetUserAgentHeader(userAgentHeader string)

SetUserAgentHeader set custom user-agent header for http request

func (*App) UpdateRecord

func (app *App) UpdateRecord(rec *Record, ignoreRevision bool) error

UpdateRecord edits a record.

If ignoreRevision is true, the record will always be updated despite the revision number. Else, the record may not be updated when the same record was updated by another client.

func (*App) UpdateRecordByKey

func (app *App) UpdateRecordByKey(rec *Record, ignoreRevision bool, keyField string) error

UpdateRecordByKey edits a record by specified key field.

func (*App) UpdateRecordStatus added in v0.2.0

func (app *App) UpdateRecordStatus(rec *Record, action *ProcessAction, assignee *Entity, ignoreRevision bool) (err error)

UpdateRecordStatus updates the Status of a record

func (*App) UpdateRecords

func (app *App) UpdateRecords(recs []*Record, ignoreRevision bool) error

UpdateRecords edits multiple records at once.

Up to 100 records can be edited at once. ignoreRevision works the same as UpdateRecord method.

func (*App) UpdateRecordsByKey

func (app *App) UpdateRecordsByKey(recs []*Record, ignoreRevision bool, keyField string) error

UpdateRecordsByKey edits multiple records by specified key fields at once.

func (*App) Upload

func (app *App) Upload(fileName, contentType string, data io.Reader) (key string, err error)

Upload uploads a file.

If successfully uploaded, the key string of the uploaded file is returned.

type AppError

type AppError struct {
	HttpStatus     string `json:"-"`       // e.g. "404 NotFound"
	HttpStatusCode int    `json:"-"`       // e.g. 404
	Message        string `json:"message"` // Human readable message.
	Id             string `json:"id"`      // A unique error ID.
	Code           string `json:"code"`    // For machines.
	Errors         string `json:"errors"`  // Error Description.
}

Server-side errors.

func (*AppError) Error

func (e *AppError) Error() string

type AppFormFields added in v0.4.0

type AppFormFields struct {
	Properties interface{} `json:"properties"`
}

type AssigneeField

type AssigneeField []User

AssigneeField is a list of user entries who are assigned to a record.

func (AssigneeField) JSONValue

func (f AssigneeField) JSONValue() interface{}

func (AssigneeField) MarshalJSON

func (f AssigneeField) MarshalJSON() ([]byte, error)

type CalcField

type CalcField string

CalcField is a field type for auto-calculated values.

func (CalcField) JSONValue

func (f CalcField) JSONValue() interface{}

func (CalcField) MarshalJSON

func (f CalcField) MarshalJSON() ([]byte, error)

type CategoryField

type CategoryField []string

CategoryField is a list of category names.

func (CategoryField) JSONValue

func (f CategoryField) JSONValue() interface{}

func (CategoryField) MarshalJSON

func (f CategoryField) MarshalJSON() ([]byte, error)

type CheckBoxField

type CheckBoxField []string

CheckBoxField is a field type for selected values in a check-box.

func (CheckBoxField) JSONValue

func (f CheckBoxField) JSONValue() interface{}

func (CheckBoxField) MarshalJSON

func (f CheckBoxField) MarshalJSON() ([]byte, error)

type Comment

type Comment struct {
	Id        string        `json:"id"`
	Text      string        `json:"text"`
	CreatedAt string        `json:"createdAt"`
	Creator   *ObjCreator   `json:"creator"`
	Mentions  []*ObjMention `json:"mentions"`
}

Comment structure

func DecodeRecordComments

func DecodeRecordComments(b []byte) ([]Comment, error)

DecodeRecordComments decodes JSON response for comment api

type CreationTimeField

type CreationTimeField time.Time

CreationTimeField is the time when a record is created.

func (CreationTimeField) JSONValue

func (t CreationTimeField) JSONValue() interface{}

func (CreationTimeField) MarshalJSON

func (t CreationTimeField) MarshalJSON() ([]byte, error)

type CreatorField

type CreatorField User

CreatorField is a user who created a record.

func (CreatorField) JSONValue

func (f CreatorField) JSONValue() interface{}

func (CreatorField) MarshalJSON

func (f CreatorField) MarshalJSON() ([]byte, error)

type Cursor added in v0.3.0

type Cursor struct {
	Id         string `json:"id"`
	TotalCount string `json:"totalCount"`
}

Object Cursor structure

type DateField

type DateField struct {
	Date  time.Time // stores date information.
	Valid bool      // false when not set.
}

DateField is a field type for dates.

func NewDateField

func NewDateField(year int, month time.Month, day int) DateField

NewDateField returns an instance of DateField.

func (DateField) JSONValue

func (f DateField) JSONValue() interface{}

func (DateField) MarshalJSON

func (f DateField) MarshalJSON() ([]byte, error)

type DateTimeField

type DateTimeField struct {
	Time  time.Time // stores time information.
	Valid bool      // false when not set.
}

DateTimeField is a field type for date & time.

func NewDateTimeField

func NewDateTimeField(year int, month time.Month, day, hour, min int) DateTimeField

NewDateTimeField returns an instance of DateTimeField.

func (DateTimeField) JSONValue

func (f DateTimeField) JSONValue() interface{}

func (DateTimeField) MarshalJSON

func (f DateTimeField) MarshalJSON() ([]byte, error)

type DecimalField

type DecimalField string

DecimalField is a field type for decimal numbers.

func (DecimalField) JSONValue

func (f DecimalField) JSONValue() interface{}

func (DecimalField) MarshalJSON

func (f DecimalField) MarshalJSON() ([]byte, error)

type Entity added in v0.2.0

type Entity struct {
	Type string `json:"type"`
	Code string `json:"code"`
}

Entity is the concrete representation of a process entity

type FieldInfo

type FieldInfo struct {
	Label       string      `json:"label"`             // Label string
	Code        string      `json:"code"`              // Unique field code
	Type        string      `json:"type"`              // Field type.  One of FT_* constant.
	NoLabel     bool        `json:"noLabel"`           // true to hide the label
	Required    bool        `json:"required"`          // true if this field must be filled
	Unique      bool        `json:"unique"`            // true if field values must be unique
	MaxValue    interface{} `json:"maxValue"`          // nil or numeric string
	MinValue    interface{} `json:"minValue"`          // nil or numeric string
	MaxLength   interface{} `json:"maxLength"`         // nil or numeric string
	MinLength   interface{} `json:"minLength"`         // nil or numeric string
	Default     interface{} `json:"defaultValue"`      // anything
	DefaultTime interface{} `json:"defaultExpression"` // nil or "NOW"
	Options     []string    `json:"options"`           // list of selectable values
	Expression  string      `json:"expression"`        // to calculate values
	Separator   bool        `json:"digit"`             // true to use thousand separator
	Medium      string      `json:"protocol"`          // "WEB", "CALL", or "MAIL"
	Format      string      `json:"format"`            // "NUMBER", "NUMBER_DIGIT", "DATETIME", "DATE", "TIME", "HOUR_MINUTE", "DAY_HOUR_MINUTE"
	Fields      []FieldInfo `json:"fields"`            // Field list of this subtable
}

FieldInfo is the meta data structure of a field.

func (*FieldInfo) UnmarshalJSON

func (fi *FieldInfo) UnmarshalJSON(data []byte) error

Work around code to handle "true"/"false" strings as booleans...

type File

type File struct {
	ContentType string `json:"contentType"` // MIME type of the file
	FileKey     string `json:"fileKey"`     // BLOB ID of the file
	Name        string `json:"name"`        // File name
	Size        uint64 `json:"size,string"` // The file size
}

File is a struct for an uploaded file.

func (*File) MarshalJSON

func (f *File) MarshalJSON() ([]byte, error)

type FileData

type FileData struct {
	ContentType string    // MIME type of the contents.
	Reader      io.Reader // File contents.
}

FileData stores downloaded file data.

type FileField

type FileField []File

FileField is a field type for uploaded files.

func (FileField) JSONValue

func (f FileField) JSONValue() interface{}

func (FileField) MarshalJSON

func (f FileField) MarshalJSON() ([]byte, error)

type GetRecordsCursorResponse added in v0.3.0

type GetRecordsCursorResponse struct {
	Records []*Record `json:"records"`
	Next    bool      `json:"next"`
}

func DecodeGetRecordsCursorResponse added in v0.3.0

func DecodeGetRecordsCursorResponse(b []byte) (rc *GetRecordsCursorResponse, err error)

type Group

type Group struct {
	Code string `json:"code"` // A unique identifer of the group(or role).
	Name string `json:"name"` // The group name.
}

Group represents a group(or role) entry.

type GroupField

type GroupField []Group

GroupField is a field type for group(or role) entries.

func (GroupField) JSONValue

func (f GroupField) JSONValue() interface{}

func (GroupField) MarshalJSON

func (f GroupField) MarshalJSON() ([]byte, error)

type LinkField

type LinkField string

LinkField is a field type for hyper-links.

func (LinkField) JSONValue

func (f LinkField) JSONValue() interface{}

func (LinkField) MarshalJSON

func (f LinkField) MarshalJSON() ([]byte, error)

type ModificationTimeField

type ModificationTimeField time.Time

ModificationTimeField is the time when a record is last modified.

func (ModificationTimeField) JSONValue

func (t ModificationTimeField) JSONValue() interface{}

func (ModificationTimeField) MarshalJSON

func (t ModificationTimeField) MarshalJSON() ([]byte, error)

type ModifierField

type ModifierField User

ModifierField is a user who modified a record last.

func (ModifierField) JSONValue

func (f ModifierField) JSONValue() interface{}

func (ModifierField) MarshalJSON

func (f ModifierField) MarshalJSON() ([]byte, error)

type MultiLineTextField

type MultiLineTextField string

MultiLineTextField is a field type for multi-line texts.

func (MultiLineTextField) JSONValue

func (f MultiLineTextField) JSONValue() interface{}

func (MultiLineTextField) MarshalJSON

func (f MultiLineTextField) MarshalJSON() ([]byte, error)

type MultiSelectField

type MultiSelectField []string

MultiSelectField is a field type for selected values in a selection box.

func (MultiSelectField) JSONValue

func (f MultiSelectField) JSONValue() interface{}

func (MultiSelectField) MarshalJSON

func (f MultiSelectField) MarshalJSON() ([]byte, error)

type ObjCreator

type ObjCreator struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

ObjCreator structure

type ObjMention

type ObjMention struct {
	Code string `json:"code"`
	Type string `json:"type"`
}

ObjMentions structure

type Organization

type Organization struct {
	Code string `json:"code"` // A unique identifer of the department.
	Name string `json:"name"` // The department name.
}

Organization represents a department entry.

type OrganizationField

type OrganizationField []Organization

OrganizationField is a field type for department entries.

func (OrganizationField) JSONValue

func (f OrganizationField) JSONValue() interface{}

func (OrganizationField) MarshalJSON

func (f OrganizationField) MarshalJSON() ([]byte, error)

type Process added in v0.2.0

type Process struct {
	Enable   bool                       `json:"enable"`
	States   map[string](*ProcessState) `json:"states"`
	Actions  []*ProcessAction           `json:"actions"`
	Revision string                     `json:"revision"`
}

Process represents the process management settings for an application

func DecodeProcess added in v0.2.0

func DecodeProcess(b []byte) (p *Process, err error)

type ProcessAction added in v0.2.0

type ProcessAction struct {
	Name       string `json:"name"`
	From       string `json:"from"`
	To         string `json:"to"`
	FilterCond string `json:"filterCond"`
}

ProcessAction representes a process management action

type ProcessAssignee added in v0.2.0

type ProcessAssignee struct {
	Type     string           `json:"type"`
	Entities []*ProcessEntity `json:"entities"`
}

ProcessAssignee represents a ProcessState assignee

type ProcessEntity added in v0.2.0

type ProcessEntity struct {
	Entity      *Entity `json:"entity"`
	IncludeSubs bool    `json:"includeSubs"`
}

ProcessEntity represents a process assignee entity

type ProcessState added in v0.2.0

type ProcessState struct {
	Name     string           `json:"name"`
	Index    string           `json:"index"`
	Assignee *ProcessAssignee `json:"assignee"`
}

ProcessState represents a process management status

type RadioButtonField

type RadioButtonField string

RadioButtonField is a field type for the selected value by a radio-button.

func (RadioButtonField) JSONValue

func (f RadioButtonField) JSONValue() interface{}

func (RadioButtonField) MarshalJSON

func (f RadioButtonField) MarshalJSON() ([]byte, error)

type Record

type Record struct {
	Fields map[string]interface{}
	// contains filtered or unexported fields
}

Record represens a record in an application.

Fields is a mapping between field IDs and fields. Although field types are shown as interface{}, they are guaranteed to be one of a *Field type in this package.

func DecodeRecord

func DecodeRecord(b []byte) (*Record, error)

DecodeRecord decodes JSON response for single-get API.

func DecodeRecords

func DecodeRecords(b []byte) ([]*Record, error)

DecodeRecords decodes JSON response for multi-get API.

func NewRecord

func NewRecord(fields map[string]interface{}) *Record

NewRecord creates an instance of Record.

The revision number is initialized to -1.

func NewRecordWithId

func NewRecordWithId(id uint64, fields map[string]interface{}) *Record

NewRecordWithId creates using an existing record id.

The revision number is initialized to -1.

func NewRecordWithIdAndRevision added in v0.4.0

func NewRecordWithIdAndRevision(id uint64, revision int64, fields map[string]interface{}) *Record

NewRecordWithIdAndRevision creates using an existing record id and revision.

func (Record) Id

func (rec Record) Id() uint64

Id returns the record number.

A record number is unique within an application.

func (Record) MarshalJSON

func (rec Record) MarshalJSON() ([]byte, error)

MarshalJSON marshals field data of a record into JSON.

func (Record) Revision

func (rec Record) Revision() int64

Revision returns the record revision number.

type RecordNumberField

type RecordNumberField string

RecordNumberField is a record number.

func (RecordNumberField) JSONValue

func (f RecordNumberField) JSONValue() interface{}

func (RecordNumberField) MarshalJSON

func (f RecordNumberField) MarshalJSON() ([]byte, error)

type RichTextField

type RichTextField string

RichTextField is a field type for HTML rich texts.

func (RichTextField) JSONValue

func (f RichTextField) JSONValue() interface{}

func (RichTextField) MarshalJSON

func (f RichTextField) MarshalJSON() ([]byte, error)

type SingleLineTextField

type SingleLineTextField string

SingleLineTextField is a field type for single-line texts.

func (SingleLineTextField) JSONValue

func (f SingleLineTextField) JSONValue() interface{}

func (SingleLineTextField) MarshalJSON

func (f SingleLineTextField) MarshalJSON() ([]byte, error)

type SingleSelectField

type SingleSelectField struct {
	String string // Selected value.
	Valid  bool   // If not selected, false.
}

SingleSelectField is a field type for the selected value in a selection box.

func (SingleSelectField) JSONValue

func (f SingleSelectField) JSONValue() interface{}

func (SingleSelectField) MarshalJSON

func (f SingleSelectField) MarshalJSON() ([]byte, error)

type StatusField

type StatusField string

StatusField is a string label of a record status.

func (StatusField) JSONValue

func (f StatusField) JSONValue() interface{}

func (StatusField) MarshalJSON

func (f StatusField) MarshalJSON() ([]byte, error)

type SubTableEntry

type SubTableEntry struct {
	Id    string                 `json:"id"`    // The entry ID
	Value map[string]interface{} `json:"value"` // Subtable data fields.
}

SubTableEntry is a type for an entry in a subtable.

type SubTableField

type SubTableField []*Record

SubTableField is a list of subtable entries.

func (SubTableField) JSONValue

func (f SubTableField) JSONValue() interface{}

func (SubTableField) MarshalJSON

func (f SubTableField) MarshalJSON() ([]byte, error)

type TestData added in v0.3.0

type TestData struct {
	// contains filtered or unexported fields
}

func GetDataTestAddRecord added in v0.3.0

func GetDataTestAddRecord() *TestData

func GetDataTestDeleteRecordComment added in v0.3.0

func GetDataTestDeleteRecordComment() *TestData

func GetDataTestForm added in v0.3.0

func GetDataTestForm() *TestData

func GetDataTestGetRecordsByCursor added in v0.3.0

func GetDataTestGetRecordsByCursor() *TestData

func GetDataTestRecordComments added in v0.3.0

func GetDataTestRecordComments() *TestData

func GetDataTestUploadFile added in v0.3.0

func GetDataTestUploadFile() *TestData

func GetTestDataAddRecord added in v0.3.0

func GetTestDataAddRecord() *TestData

func GetTestDataAddRecordComment added in v0.3.0

func GetTestDataAddRecordComment() *TestData

func GetTestDataAddRecords added in v0.3.0

func GetTestDataAddRecords() *TestData

func GetTestDataCreateCursor added in v0.3.0

func GetTestDataCreateCursor() *TestData

func GetTestDataDeleteCursor added in v0.3.0

func GetTestDataDeleteCursor() *TestData

func GetTestDataDeleteRecords added in v0.3.0

func GetTestDataDeleteRecords() *TestData

func GetTestDataGetRecord added in v0.3.0

func GetTestDataGetRecord() *TestData

func GetTestDataGetRecords added in v0.3.0

func GetTestDataGetRecords() *TestData

func GetTestDataProcess added in v0.3.0

func GetTestDataProcess() *TestData

func GetTestDataUpdateRecordByKey added in v0.3.0

func GetTestDataUpdateRecordByKey() *TestData

type TimeField

type TimeField struct {
	Time  time.Time // stores time information.
	Valid bool      // false when not set.
}

TimeField is a field type for times.

func NewTimeField

func NewTimeField(hour, min int) TimeField

NewTimeField returns an instance of TimeField.

func (TimeField) JSONValue

func (f TimeField) JSONValue() interface{}

func (TimeField) MarshalJSON

func (f TimeField) MarshalJSON() ([]byte, error)

type UpdateKey

type UpdateKey struct {
	FieldCode string
	Field     UpdateKeyField
}

func (UpdateKey) MarshalJSON

func (f UpdateKey) MarshalJSON() ([]byte, error)

type UpdateKeyField

type UpdateKeyField interface {
	JSONValue() interface{}
}

type User

type User struct {
	Code string `json:"code"` // A unique identifer of the user.
	Name string `json:"name"` // The user name.
}

User represents a user entry.

type UserField

type UserField []User

UserField is a field type for user entries.

func (UserField) JSONValue

func (f UserField) JSONValue() interface{}

func (UserField) MarshalJSON

func (f UserField) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL