Documentation ¶
Index ¶
- func FloatField(rec interface{}, name string) (float64, error)
- func IntField(rec interface{}, name string) (int, error)
- func One2manyField(rec interface{}, name string) ([]int, error)
- func StringField(rec interface{}, name string) (string, error)
- func Val2Float(f interface{}) (float64, bool)
- func Val2Int(f interface{}) (int, bool)
- func Val2One2many(f interface{}) []int
- func Val2String(f interface{}) (string, bool)
- type AuthError
- type AuthErrorData
- type AuthParams
- type AuthRequest
- type AuthResponse
- type AuthResult
- type Client
- func (client *Client) Call(model, method string, args []interface{}, kwargs map[string]interface{}) (interface{}, error)
- func (client *Client) Create(model string, values map[string]interface{}) (int, error)
- func (client *Client) Delete(model string, ids []int) (bool, error)
- func (client *Client) GetBaseURL() string
- func (client *Client) GetServerVersion() string
- func (client *Client) IsValid() bool
- func (client *Client) Read(model string, ids []int, fields []string) ([]interface{}, error)
- func (client *Client) Search(model string, domain []interface{}) ([]int, error)
- func (client *Client) SearchRead(model string, domain []interface{}, fields []string) ([]interface{}, error)
- func (client *Client) WithContext(ctx map[string]interface{}) *Client
- func (client *Client) Write(model string, ids []int, values map[string]interface{}) (bool, error)
- type List
- type Many2oneFK
- type ODateTime
- type OFloat
- type OInt
- type OMany2one
- type OString
- type OdooConfig
- type RPCError
- type RPCErrorData
- type RPCResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FloatField ¶
FloatField gets float64 value from a record
func One2manyField ¶
One2manyField gets one2many []int from a record
func StringField ¶
StringField gets int value from a record
func Val2One2many ¶
func Val2One2many(f interface{}) []int
Val2One2many converts field value to []int
func Val2String ¶
Val2String converts a field value to string
Types ¶
type AuthError ¶
type AuthError struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` Data *AuthErrorData `json:"data,omitempty"` }
AuthError struct holds data for an authentication error response
type AuthErrorData ¶
type AuthErrorData struct { Name OString `json:"name,omitempty"` Debug OString `json:"debug,omitempty"` Message OString `json:"message,omitempty"` Arguments []interface{} `json:"arguments,omitempty"` ExceptionType OString `json:"exception_type,omitempty"` }
AuthErrorData struct holds data from an authentication error response
type AuthParams ¶
type AuthParams struct { DB string `json:"db"` Login string `json:"login"` Password string `json:"password"` }
AuthParams struct holds authentication parameters required for an auth request
type AuthRequest ¶
type AuthRequest struct { ID string `json:"id"` JSONRPC string `json:"jsonrpc"` Method string `json:"method"` Params AuthParams `json:"params"` }
AuthRequest struct used to hold data for an authentication request
type AuthResponse ¶
type AuthResponse struct { ID OString `json:"id"` JSONRPC OString `json:"jsonrpc"` Result *AuthResult `json:"result"` Error *AuthError `json:"error"` }
AuthResponse struct holds response data returned from Odoo server
type AuthResult ¶
type AuthResult struct { UID OInt `json:"uid"` IsSystem bool `json:"is_system"` IsAdmin bool `json:"is_admin"` UserContext map[string]interface{} `json:"user_context"` DB OString `json:"db"` ServerVersion OString `json:"server_version"` ServerVersionInfo []interface{} `json:"server_version_info"` Name OString `json:"name"` UserName OString `json:"username"` PartnerDisplayName OString `json:"partner_display_name"` CompanyID OInt `json:"company_id"` PartnerID OInt `json:"partner_id"` WebBaseURL OString `json:"web.base.url"` }
AuthResult struct hold authentication data returned after successfull login
type Client ¶
type Client struct { Auth *AuthResponse Context map[string]interface{} // contains filtered or unexported fields }
Client holds client connection and the server metadata
func ClientConnect ¶
ClientConnect creates a new client from a named server configuration
func (*Client) Call ¶
func (client *Client) Call(model, method string, args []interface{}, kwargs map[string]interface{}) (interface{}, error)
Call calls remote Odoo method
func (*Client) GetBaseURL ¶
GetBaseURL gets client's connection base URL
func (*Client) GetServerVersion ¶
GetServerVersion gets Odoo server's version
func (*Client) Read ¶
Read reads records for the specified model with specified IDs The read will include only specified fields, or if empty will return all fields. Beware that retrieving all fields will normally take longer time than selective fields, depending on the model's schema complexity
func (*Client) Search ¶
Search searches records in the specified model, matching the criteria specified in domain, which is similar to domain in Odoo python syntax
func (*Client) SearchRead ¶
func (client *Client) SearchRead(model string, domain []interface{}, fields []string) ([]interface{}, error)
SearchRead is a convenience method that search and read in one go
func (*Client) WithContext ¶
WithContext returns a new Client with added context
type Many2oneFK ¶
Many2oneFK struct holds data for a Many2one field returned from Odoo
func Many2oneField ¶
func Many2oneField(rec interface{}, name string) (*Many2oneFK, error)
Many2oneField gets Many2one struct from a record
func Val2Many2one ¶
func Val2Many2one(f interface{}) *Many2oneFK
Val2Many2one converts field value to Many2oneFK
type ODateTime ¶
ODateTime is Odoo datetime
func (*ODateTime) UnmarshalJSON ¶
UnmarshalJSON parses ODateTime from JSON
type OFloat ¶
type OFloat float64
OFloat is Odoo Float
func (*OFloat) UnmarshalJSON ¶
UnmarshalJSON parses float value from JSON
type OInt ¶
type OInt int
OInt is Odoo Int
func (*OInt) UnmarshalJSON ¶
UnmarshalJSON parses Int value from JSON
type OMany2one ¶
OMany2one is a struct that hold Many2one value from Odoo
func (*OMany2one) UnmarshalJSON ¶
UnmarshalJSON parses Many2one struct from JSON
type OString ¶
type OString string
OString os Odoo String
func (*OString) UnmarshalJSON ¶
UnmarshalJSON parses OString from JSON
type OdooConfig ¶
OdooConfig holds Odoo connection configuration data
func LoadOdooConfig ¶
func LoadOdooConfig(serverName string) (*OdooConfig, error)
LoadOdooConfig loads odoo server configuration from file
func (*OdooConfig) CreateOdooClient ¶
func (conf *OdooConfig) CreateOdooClient() (*Client, error)
CreateOdooClient creates Odoo client based from a configuration
type RPCError ¶
type RPCError struct { Code OInt `json:"code"` Message OString `json:"message"` Data RPCErrorData `json:"data"` }
RPCError struct holds data related to RPC error
type RPCErrorData ¶
type RPCErrorData struct { Name OString `json:"name"` Debug OString `json:"debug"` Message OString `json:"message"` Arguments []interface{} `json:"arguments"` ExceptionType OString `json:"exception_type"` }
RPCErrorData struct holds error data from a request error
type RPCResponse ¶
type RPCResponse struct { ID OString `json:"id"` JSONRPC OString `json:"jsonrpc"` Result interface{} `json:"result"` Error *RPCError `json:"error"` }
RPCResponse struct holds data returned from server on a successfull request