persist.googlesheets
Module persist.googlesheets
API

ballerinax/persist.googlesheets Ballerina library
Functions
getSheetIds
Classes
persist.googlesheets: PersistGoogleSheetsStream
next
function next() returns record {| value record {} |}|Error?
close
function close() returns Error?
Clients
persist.googlesheets: GoogleSheetsClient
The client used by the generated persist clients to abstract and execute API calls that are required to perform CRUD operations.
Constructor
Initializes the GSheetClient
.
init (Client googleSheetClient, Client httpSheetsClient, SheetMetadata & readonly sheetMetadata, string & readonly spreadsheetId, int & readonly sheetId)
- googleSheetClient Client - The
sheets:Client
, which is used to execute google sheets operations
- httpSheetsClient Client - The
http:Client
, which is used to execute http requests
- sheetMetadata SheetMetadata & readonly - Metadata of the entity
- spreadsheetId string & readonly - Id of the spreadsheet
- sheetId int & readonly - Id of the sheet
runBatchInsertQuery
function runBatchInsertQuery(record {}[] insertRecords) returns Error?
Performs an append operation to insert entity instances into a table.
Parameters
- insertRecords record {}[] - The entity records to be inserted into the table
Return Type
- Error? - Error on failure, or
()
on success
runReadByKeyQuery
function runReadByKeyQuery(typedesc<record {}> rowType, typedesc<record {}> rowTypeWithIdFields, map<anydata> typeMap, anydata key, string[] fields, string[] include, typedesc<record {}>[] typeDescriptions) returns record {}|Error
Performs an SQL SELECT
operation to read a single entity record from the database.
Parameters
- rowType typedesc<record {}> - The type description of the entity to be retrieved
- rowTypeWithIdFields typedesc<record {}> - The type description of the entity to be retrieved with the key fields included
- typeMap map<anydata> - The data types of the record
- key anydata - The value of the key (to be used as the
WHERE
clauses)
- fields string[] (default []) - The fields to be retrieved
- include string[] (default []) - The relations to be retrieved (SQL
JOINs
to be performed)
- typeDescriptions typedesc<record {}>[] (default []) - The type descriptions of the relations to be retrieved
Return Type
- record {}|Error - A record in the
rowType
type or apersist:Error
if the operation fails
runReadQuery
function runReadQuery(typedesc<record {}> rowType, map<anydata> typeMap, string[] fields, string[] include) returns stream<record {}, error?>|Error
Parameters
- rowType typedesc<record {}> - The type description of the entity to be retrieved
- typeMap map<anydata> - The data types of the record
- fields string[] (default []) - The fields to be retrieved
- include string[] (default []) - The associations to be retrieved
Return Type
readTableAsStream
function readTableAsStream(typedesc<record {}> rowType, map<anydata> typeMap, string[] fields, string[] include) returns stream<record { anydata... }, Error?>|error
Parameters
- rowType typedesc<record {}> - The type description of the entity to be retrieved
- typeMap map<anydata> - The data types of the record
- fields string[] (default []) - The fields to be retrieved
- include string[] (default []) - The associations to be retrieved
Return Type
runUpdateQuery
function runUpdateQuery(anydata key, record {} updateRecord) returns Error?
Performs an SQL UPDATE
operation to update multiple entity records in the database.
Parameters
- key anydata - the key of the entity
- updateRecord record {} - the record to be updated
Return Type
- Error? -
()
if the operation is performed successfully. AForeignKeyViolationError
if the operation violates a foreign key constraint. Apersist:Error
if the operation fails due to another reason.
runDeleteQuery
function runDeleteQuery(anydata deleteKey) returns Error?
Performs an SQL DELETE
operation to delete an entity record from the database.
Parameters
- deleteKey anydata - The key used to delete an entity record
Return Type
- Error? -
()
if the operation is performed successfully or apersist:Error
if the operation fails
getKeyFields
function getKeyFields() returns string[]
getManyRelations
function getManyRelations(record {} 'object, string[] fields, string[] include, typedesc<record {}>[] typeDescriptions) returns Error?
Parameters
- 'object record {} -
- fields string[] -
- include string[] -
- typeDescriptions typedesc<record {}>[] -
addKeyFields
Parameters
- fields string[] -
Records
persist.googlesheets: SheetFieldMetadata
Represents the metadata associated with a field in the entity record.
Fields
- columnName string - The name of the spreadsheet column to which the field is mapped
- columnId string - The alphabetical Id of the column
persist.googlesheets: SheetMetadata
Fields
- entityName string -
- tableName string -
- fieldMetadata map<SheetFieldMetadata> -
- keyFields string[] -
- range string -
- queryOne
function(anydata) returns (record {}|Error)
-
Union types
persist.googlesheets: SheetFieldType
SheetFieldType
Generic type that can used to store any of the types supported by google sheets
persist.googlesheets: SheetTimeType
SheetTimeType
Generic type that can used to store any of time types supported by sheets
Import
import ballerinax/persist.googlesheets;
Metadata
Released date: 9 days ago
Version: 1.5.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.11.0
GraalVM compatible: Yes
Pull count
Total: 28
Current verison: 0
Weekly downloads
Keywords
persist
googlesheets
experimental
Contributors