# Module cloudi_service_db_pgsql

- Description
- Data Types
- Function Index
- Function Details

### CloudI PostgreSQL Data Module

.

Copyright © 2009-2020 Michael Truog

Version: 1.8.1 Jun 3 2020 19:37:55 ------------------------------------------------------------------------

Behaviours: `cloudi_service`.

Authors: Michael Truog (`mjtruog at protonmail dot com`).

## Description

### CloudI PostgreSQL Data Module

## Data Types

### agent()

`agent() = cloudi:agent()`

### common_result()

`common_result() = {updated, count()} | {updated, count(), rows()} | {selected, rows()} | {error, any()}`

### count()

`count() = non_neg_integer()`

### module_response()

`module_response(Result) = {{ok, Result}, NewAgent::agent()} | {{error, cloudi:error_reason()}, NewAgent::agent()}`

### rows()

`rows() = [tuple()]`

### service_name()

`service_name() = cloudi:service_name()`

### timeout_milliseconds()

`timeout_milliseconds() = cloudi:timeout_milliseconds()`

## Function Index

binary_to_bytea/1 | #### Postgres string encoding of binary data. Better to use equery.
cloudi_service_handle_info/3 |
cloudi_service_handle_request/11 |
cloudi_service_init/4 |
cloudi_service_terminate/3 |
equery/4 | #### An extended SQL query. .
equery/5 | #### An extended SQL query with a timeout. .
squery/3 | #### A SQL simple query. .
squery/4 | #### A SQL simple query with a timeout. .
transaction/3 | #### A list of SQL simple query for a transaction. .
transaction/4 | #### A list of SQL simple query for a transaction with a timeout. .

## Function Details

### binary_to_bytea/1

`binary_to_bytea(B::binary()) -> string()`

#### Postgres string encoding of binary data.

Better to use equery.

### cloudi_service_handle_info/3

`cloudi_service_handle_info(Request, State, Dispatcher) -> any()`

### cloudi_service_handle_request/11

`cloudi_service_handle_request(RequestType, Name, Pattern, RequestInfo, Request, Timeout, Priority, TransId, Pid, State, Dispatcher) -> any()`

### cloudi_service_init/4

`cloudi_service_init(Args, Prefix, Timeout, Dispatcher) -> any()`

### cloudi_service_terminate/3

`cloudi_service_terminate(Reason, Timeout, State) -> any()`

### equery/4

`equery(Agent::agent(), Name::service_name(), Query::string() | binary(), Parameters::list()) -> module_response(any())`

#### An extended SQL query.

### equery/5

`equery(Agent::agent(), Name::service_name(), Query::string() | binary(), Parameters::list(), Timeout::timeout_milliseconds()) -> module_response(any())`

#### An extended SQL query with a timeout.

### squery/3

`squery(Agent::agent(), Name::service_name(), Query::string() | binary()) -> module_response(any())`

#### A SQL simple query.

### squery/4

`squery(Agent::agent(), Name::service_name(), Query::string() | binary(), Timeout::timeout_milliseconds()) -> module_response(any())`

#### A SQL simple query with a timeout.

### transaction/3

`transaction(Agent::agent(), Name::service_name(), QueryList::[string() | binary()]) -> module_response(ok | {error, any()})`

#### A list of SQL simple query for a transaction.

### transaction/4

`transaction(Agent::agent(), Name::service_name(), QueryList::[string() | binary()], Timeout::timeout_milliseconds()) -> module_response(ok | {error, any()})`

#### A list of SQL simple query for a transaction with a timeout.

Generated by EDoc