Documentation ¶
Index ¶
- type FindCommand
- type FindCriterion
- type FindRequest
- type Record
- func (r *Record) Bool(fieldName string) (bool, error)
- func (r *Record) Commit() error
- func (r *Record) CommitFileToContainer(fieldName, filepath string) error
- func (r *Record) CommitToContainer(fieldName string, filename string, dataBuf bytes.Buffer) error
- func (r *Record) Create() error
- func (r *Record) Delete() error
- func (r *Record) Float32(fieldName string) (float32, error)
- func (r *Record) Float64(fieldName string) (float64, error)
- func (r *Record) GetField(fieldName string) interface{}
- func (r *Record) Int(fieldName string) (int, error)
- func (r *Record) Int32(fieldName string) (int32, error)
- func (r *Record) Int64(fieldName string) (int64, error)
- func (r *Record) Map(obj interface{}) error
- func (r *Record) Revert()
- func (r *Record) SetField(fieldName string, value interface{})
- func (r *Record) String(fieldName string) (string, error)
- type ResponseBody
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FindCommand ¶
type FindCommand map[string]interface{}
FindCommand represents the findcommand
func NewFindCommand ¶
func NewFindCommand(requests ...interface{}) FindCommand
NewFindCommand returns a findrequest
func (*FindCommand) AddRequest ¶
func (c *FindCommand) AddRequest(request FindRequest)
AddRequest appends a specified FindRequest to the FindCommand
func (FindCommand) SetLimit ¶
func (c FindCommand) SetLimit(limit int) FindCommand
SetLimit sets the limit for the number of records returned by the findcommand
func (FindCommand) SetOffset ¶
func (c FindCommand) SetOffset(offset int) FindCommand
SetOffset sets the offset for the records returned by the findcommand
type FindCriterion ¶
type FindCriterion struct { FieldName string Value interface{} }
FindCriterion represents the findcriterion that builds up a findrequest
func NewFindCriterion ¶
func NewFindCriterion(fieldName string, value interface{}) FindCriterion
NewFindCriterion returns a new findcriterion
type FindRequest ¶
type FindRequest map[string]interface{}
FindRequest represents the findrequest that builds up a findcommand
func NewFindRequest ¶
func NewFindRequest(criterions ...FindCriterion) FindRequest
NewFindRequest returns a new findrequest
func (*FindRequest) AddCriterion ¶
func (r *FindRequest) AddCriterion(criterion FindCriterion)
AddCriterion appends a specified FindCriterion to the FindRequest
func (FindRequest) Omit ¶
func (r FindRequest) Omit() FindRequest
Omit sets the findrequest to omit matching records
type Record ¶
type Record struct { ID string Layout string StagedChanges map[string]interface{} FieldData map[string]interface{} Session *Session }
Record interface for some magic with methods
func (*Record) Bool ¶ added in v2.1.0
Bool gets the data in the specified field and returns it as an bool. The FileMaker database field needs to be a number field. Numbers larger than `0` return `true` and `0` or below returns `false`.
func (*Record) Commit ¶
Commit commits the changes made to the record using the same session the record was retrieved/created with
func (*Record) CommitFileToContainer ¶ added in v2.4.0
CommitFileToContainer commits the specified file to specified container field in the record
func (*Record) CommitToContainer ¶ added in v2.3.0
CommitToContainer commits the specified bytes buffer to the specified container field in the record.
func (*Record) Delete ¶
Delete deletes the record using the same session the record was retrieved with
func (*Record) Float32 ¶ added in v2.1.0
Float32 gets the data in the specified field and returns it as an float32. The FileMaker database field needs to be a number field.
func (*Record) Float64 ¶ added in v2.1.0
Float64 gets the data in the specified field and returns it as an float64. The FileMaker database field needs to be a number field.
func (*Record) GetField ¶
GetField gets the value of a field in the given record and returns it as an `interface{}`
func (*Record) Int ¶ added in v2.1.0
Int gets the data in the specified field and returns it as an int. The FileMaker database field needs to be a number field.
func (*Record) Int32 ¶ added in v2.1.0
Int32 gets the data in the specified field and returns it as an int32. The FileMaker database field needs to be a number field.
func (*Record) Int64 ¶ added in v2.1.0
Int64 gets the data in the specified field and returns it as an int64. The FileMaker database field needs to be a number field.
func (*Record) Map ¶ added in v2.2.0
Map takes a struct and inserts the field data of the record in the struct fields with an `fm`-tag matching the record field name.
Example struct: `
type example struct { Name string `fm:"Name"` Age int `fm:"Age"` }
`
- A pointer to the object must be passed (i.e `Record.Map(&obj)`).
- Nested structs are not supported.
Supported types:
- string
- int
- int64
- float64
- bool
func (*Record) Revert ¶
func (r *Record) Revert()
Revert discards all uncommited changes made to the record
type ResponseBody ¶
type ResponseBody struct { Messages []struct { Code string `json:"code"` Message string `json:"message"` } `json:"messages"` Response struct { Token string `json:"token"` ModID string `json:"modId"` RecordID string `json:"recordId"` DataInfo struct { Database string `json:"database"` Layout string `json:"layout"` Table string `json:"table"` TotalRecordCount int `json:"totalRecordCount"` FoundCount int `json:"foundCount"` ReturnedCount int `json:"returnedCount"` } `json:"dataInfo"` Data []interface{} `json:"data"` } `json:"response"` }
ResponseBody represents the json body received from http requests to the filemaker api
type Session ¶
type Session struct { Token string Protocol string Host string Database string Username string Password string }
Session is used for subsequent requests to the host
func Resume ¶
func Resume(host string, database string, username string, password string, token string) (*Session, error)
Resume resumes a database session with the specified token
func (*Session) CreateRecord ¶
CreateRecord returns a new empty record for the specified layout