Documentation
¶
Index ¶
- type Bool
- type Client
- func (c *Client) Close()
- func (c *Client) Config() *ClientConfig
- func (c *Client) Count(model string, criteria *Criteria, options *Options) (int64, error)
- func (c *Client) Create(model string, values interface{}) (int64, error)
- func (c *Client) Delete(model string, ids []int64) error
- func (c *Client) ExecuteKw(method, model string, args []interface{}, options *Options) (interface{}, error)
- func (c *Client) ExecuteKwByte(method, model string, args []interface{}, options *Options) ([]byte, error)
- func (c *Client) FieldsGet(model string, options *Options) (map[string]interface{}, error)
- func (c *Client) GetProtocol() ProtocolType
- func (c *Client) IsJSONRPC() bool
- func (c *Client) IsXMLRPC() bool
- func (c *Client) Ping() error
- func (c *Client) Read(model string, ids []int64, options *Options, elem interface{}) error
- func (c *Client) Search(model string, criteria *Criteria, options *Options) ([]int64, error)
- func (c *Client) SearchRead(model string, criteria *Criteria, options *Options, elem interface{}) error
- func (c *Client) Update(model string, ids []int64, values interface{}) error
- func (c *Client) Version() (Version, error)
- type ClientConfig
- type ConnectionPool
- func (p *ConnectionPool) AddClient(key string, cfg ClientConfig) error
- func (p *ConnectionPool) CheckConnections()
- func (p *ConnectionPool) Close()
- func (p *ConnectionPool) GetClient(key string) (*Client, error)
- func (p *ConnectionPool) NumConnections() int
- func (p *ConnectionPool) RemoveClient(key string)
- type Criteria
- type Float
- type Int
- type JSONRPCClient
- func (c *JSONRPCClient) Authenticate(db, login, password string) error
- func (c *JSONRPCClient) Call(method string, params interface{}) (*JSONRPCResponse, error)
- func (c *JSONRPCClient) Close()
- func (c *JSONRPCClient) ExecuteKw(db string, uid int64, password string, model string, method string, ...) (interface{}, error)
- func (c *JSONRPCClient) GetSessionID() string
- func (c *JSONRPCClient) GetUID() int64
- type JSONRPCError
- type JSONRPCRequest
- type JSONRPCResponse
- type Many2One
- type Options
- func (o *Options) Add(opt string, v interface{}) *Options
- func (o *Options) AllFields(fields ...string) *Options
- func (o *Options) Attributes(attributes ...string) *Options
- func (o *Options) FetchFields(fields ...string) *Options
- func (o *Options) Limit(limit int) *Options
- func (o *Options) Offset(offset int) *Options
- type Pool
- type ProtocolType
- type Relation
- func (r *Relation) AddNewRecord(values interface{})
- func (r *Relation) AddRecord(record int64)
- func (r *Relation) DeleteRecord(record int64)
- func (r *Relation) Get() []int64
- func (r *Relation) RemoveAllRecords()
- func (r *Relation) RemoveRecord(record int64)
- func (r *Relation) ReplaceAllRecords(newRecords []int64)
- func (r *Relation) UpdateRecord(record int64, values interface{})
- type Selection
- type String
- type Time
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides high and low level functions to interact with odoo
func NewClient ¶
func NewClient(cfg *ClientConfig) (*Client, error)
NewClient creates a new *Client.
func (*Client) Config ¶
func (c *Client) Config() *ClientConfig
func (*Client) Count ¶
Count model records matching with *Criteria. https://www.odoo.com/documentation/13.0/webservices/odoo.html#count-records
func (*Client) Create ¶
Create a new model. https://www.odoo.com/documentation/13.0/webservices/odoo.html#create-records
func (*Client) Delete ¶
Delete existing model row(s). https://www.odoo.com/documentation/13.0/webservices/odoo.html#delete-records
func (*Client) ExecuteKw ¶
func (c *Client) ExecuteKw(method, model string, args []interface{}, options *Options) (interface{}, error)
ExecuteKw is a RPC function. The lowest library function. It is use for all function related to object endpoints.
func (*Client) ExecuteKwByte ¶
func (*Client) FieldsGet ¶
FieldsGet inspect model fields. https://www.odoo.com/documentation/13.0/webservices/odoo.html#listing-record-fields
func (*Client) GetProtocol ¶
func (c *Client) GetProtocol() ProtocolType
GetProtocol returns the current protocol being used
func (*Client) Read ¶
Read model records matching with ids. https://www.odoo.com/documentation/13.0/webservices/odoo.html#read-records
func (*Client) Search ¶
Search model record ids matching with *Criteria. https://www.odoo.com/documentation/13.0/webservices/odoo.html#list-records
func (*Client) SearchRead ¶
func (c *Client) SearchRead(model string, criteria *Criteria, options *Options, elem interface{}) error
SearchRead search model records matching with *Criteria and read it. https://www.odoo.com/documentation/13.0/webservices/odoo.html#search-and-read
func (*Client) Update ¶
Update existing model row(s). https://www.odoo.com/documentation/13.0/webservices/odoo.html#update-records
type ClientConfig ¶
type ClientConfig struct {
Database string
Admin string
Password string
URL string
Pool *Pool
Protocol ProtocolType
}
ClientConfig is the configuration to create a new *Client by givin connection infomations.
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
ConnectionPool manages a collection of godoo clients.
func NewConnectionPool ¶
func NewConnectionPool(retryInterval time.Duration, maxRetries int, serverConfigs map[string]*ClientConfig) (*ConnectionPool, error)
NewConnectionPool creates and initializes a new connection pool. It attempts to connect to all servers defined in serverConfigs and retries failed connections in the background.
func (*ConnectionPool) AddClient ¶
func (p *ConnectionPool) AddClient(key string, cfg ClientConfig) error
AddClient creates a new client and adds it to the pool.
func (*ConnectionPool) CheckConnections ¶
func (p *ConnectionPool) CheckConnections()
CheckConnections verifies all active connections and attempts to reconnect any that have failed.
func (*ConnectionPool) Close ¶
func (p *ConnectionPool) Close()
Close gracefully closes all client connections in the pool.
func (*ConnectionPool) GetClient ¶
func (p *ConnectionPool) GetClient(key string) (*Client, error)
GetClient retrieves a client from the pool by its key.
func (*ConnectionPool) NumConnections ¶
func (p *ConnectionPool) NumConnections() int
NumConnections returns the number of active connections in the pool.
func (*ConnectionPool) RemoveClient ¶
func (p *ConnectionPool) RemoveClient(key string)
RemoveClient closes and removes a client from the pool.
type Criteria ¶
type Criteria []*criterion
Criteria is a set of criterion, each criterion is a triple (field_name, operator, value). It allow you to search models. see documentation: https://www.odoo.com/documentation/13.0/reference/orm.html#reference-orm-domains
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float is a float64 wrapper
type JSONRPCClient ¶
type JSONRPCClient struct {
// contains filtered or unexported fields
}
JSONRPCClient handles JSON-RPC communication with Odoo
func NewJSONRPCClient ¶
func NewJSONRPCClient(baseURL string, pool *Pool) *JSONRPCClient
NewJSONRPCClient creates a new JSON-RPC client
func (*JSONRPCClient) Authenticate ¶
func (c *JSONRPCClient) Authenticate(db, login, password string) error
Authenticate performs JSON-RPC authentication
func (*JSONRPCClient) Call ¶
func (c *JSONRPCClient) Call(method string, params interface{}) (*JSONRPCResponse, error)
Call makes a JSON-RPC method call
func (*JSONRPCClient) ExecuteKw ¶
func (c *JSONRPCClient) ExecuteKw(db string, uid int64, password string, model string, method string, args []interface{}, kwargs map[string]interface{}) (interface{}, error)
ExecuteKw executes a method on an Odoo model
func (*JSONRPCClient) GetSessionID ¶
func (c *JSONRPCClient) GetSessionID() string
GetSessionID returns the current session ID
func (*JSONRPCClient) GetUID ¶
func (c *JSONRPCClient) GetUID() int64
GetUID returns the authenticated user ID
type JSONRPCError ¶
type JSONRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
JSONRPCError represents a JSON-RPC error
type JSONRPCRequest ¶
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params interface{} `json:"params"`
ID interface{} `json:"id"`
}
JSONRPCRequest represents a JSON-RPC 2.0 request
type JSONRPCResponse ¶
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"`
Result interface{} `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
ID interface{} `json:"id"`
}
JSONRPCResponse represents a JSON-RPC 2.0 response
type Many2One ¶
Many2One represents odoo many2one type. https://www.odoo.com/documentation/13.0/reference/orm.html#relational-fields
func NewMany2One ¶
NewMany2One create a new *Many2One.
type Options ¶
type Options map[string]interface{}
Options allow you to filter search results.
func (*Options) AllFields ¶
AllFields is useful for FieldsGet function. It represents the fields to document you want odoo to return. https://www.odoo.com/documentation/13.0/reference/orm.html#fields-views
func (*Options) Attributes ¶
Attributes is useful for FieldsGet function. It represents the attributes to document you want odoo to return. https://www.odoo.com/documentation/13.0/reference/orm.html#fields-views
func (*Options) FetchFields ¶
FetchFields allow you to precise the model fields you want odoo to return. https://www.odoo.com/documentation/13.0/webservices/odoo.html#search-and-read
func (*Options) Limit ¶
Limit adds the limit options. https://www.odoo.com/documentation/13.0/webservices/odoo.html#pagination
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) CloseExpired ¶
func (p *Pool) CloseExpired()
type ProtocolType ¶
type ProtocolType string
ProtocolType defines the RPC protocol type
const ( ProtocolXMLRPC ProtocolType = "xmlrpc" ProtocolJSONRPC ProtocolType = "jsonrpc" )
type Relation ¶
type Relation struct {
// contains filtered or unexported fields
}
Relation represents odoo one2many and many2many types. https://www.odoo.com/documentation/13.0/reference/orm.html#relational-fields
func (*Relation) AddNewRecord ¶
func (r *Relation) AddNewRecord(values interface{})
AddNewRecord is an helper to create a new record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) AddRecord ¶
AddRecord is an helper to add an existing record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) DeleteRecord ¶
DeleteRecord is an helper to delete an existing record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) RemoveAllRecords ¶
func (r *Relation) RemoveAllRecords()
RemoveAllRecords is an helper to remove all records of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) RemoveRecord ¶
RemoveRecord is an helper to remove an existing record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) ReplaceAllRecords ¶
ReplaceAllRecords is an helper to replace all records of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) UpdateRecord ¶
UpdateRecord is an helper to update an existing record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
type Selection ¶
type Selection struct {
// contains filtered or unexported fields
}
Selection represents selection odoo type.
func NewSelection ¶
func NewSelection(v interface{}) *Selection
NewSelection creates a new *Selection.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a string wrapper