Riferimento API

Database (SQL raw)

Accesso in lettura/scrittura low-level al database SQLite di PlainApp. Destinato al debug — un uso improprio può corrompere lo stato dell'app.

Definizioni di tipo

bash
type DbTableInfo {
  # Column metadata for a single table.
  # Platform-dependent; see PlainApp source for the full list of fields.
}

# dbTableRows returns an array of JSON objects (one per row).
# Each object maps column name to value.
# dbTables and dbTableRowCount return plain scalars.

Operazioni

query

dbPath

Recupera il percorso filesystem assoluto del database SQLite di PlainApp.

bash
query GetDbPath {
  dbPath
}
query

dbTables

Elenca tutti i nomi delle tabelle nel database.

bash
query GetDbTables {
  dbTables
}
query

dbTableInfo

Recupera i metadati delle colonne per una tabella.

bash
query GetDbTableInfo($table: String!) {
  dbTableInfo(table: $table) { name type notNull defaultValue primaryKey }
}
query

dbTableRowCount

Conta le righe in una tabella.

bash
query GetDbTableRowCount($table: String!) {
  dbTableRowCount(table: $table)
}
query

dbTableRows

Legge righe da una tabella con paginazione. Ogni riga è restituita come oggetto JSON che mappa nomi colonna a valori.

bash
query GetDbTableRows($table: String!, $offset: Int!, $limit: Int!) {
  dbTableRows(table: $table, offset: $offset, limit: $limit)
}
mutation

createDbTableRow

Inserisce una riga in una tabella. L'argomento row è una stringa JSON.

bash
mutation CreateDbTableRow($table: String!, $row: String!) {
  createDbTableRow(table: $table, row: $row)
}
mutation

deleteDbTableRows

Elimina righe da una tabella per id chiave primaria.

bash
mutation DeleteDbTableRows($table: String!, $ids: [String!]!) {
  deleteDbTableRows(table: $table, ids: $ids)
}