Skip to content

Database

MongoDB, MySQL, PostgreSQL, and Redis database operations.

9 modules

ModuleDescription
Wstawianie do bazy danychWstaw dane do tabel bazy danych
Zapytanie do bazy danychWykonaj zapytania SQL na bazach danych PostgreSQL, MySQL lub SQLite
Aktualizacja bazy danychAktualizuj dane w tabelach bazy danych
MongoDB FindZapytaj dokumenty z kolekcji MongoDB
MongoDB InsertWstaw jeden lub wiecej dokumentow do kolekcji MongoDB
Zapytanie MySQLWykonaj zapytanie SQL na bazie danych MySQL i zwroc wyniki
Zapytanie PostgreSQLWykonaj zapytanie SQL na bazie danych PostgreSQL i zwroc wyniki
Redis GetPobierz wartosc z pamieci podreccznej Redis
Redis SetUstaw wartosc w pamieci podrecznej Redis

Modules

Wstawianie do bazy danych

database.insert

Wstaw dane do tabel bazy danych

Parameters:

NameTypeRequiredDefaultDescription
tablestringYes-Name of the table
dataobjectYes-Data to insert or update
database_typeselect (postgresql, mysql, sqlite)NopostgresqlDatabase type to connect to
connection_stringstringNo-Database connection string
hoststringNo-Database host
portnumberNo-Database port
databasestringNo-Database name
userstringNo-Database username
passwordstringNo-Database password
returningarrayNo-Columns to return after insert (PostgreSQL)

Output:

FieldTypeDescription
inserted_countnumberLiczba wstawionych wierszy
returning_dataarrayLiczba wstawionych wierszy

Example: Insert single row

yaml
table: users
data: {"name": "John", "email": "john@example.com"}
database_type: postgresql

Zapytanie do bazy danych

database.query

Wykonaj zapytania SQL na bazach danych PostgreSQL, MySQL lub SQLite

Parameters:

NameTypeRequiredDefaultDescription
querystringYes-SQL query to execute
paramsarrayNo[]Parameters for parameterized queries (prevents SQL injection)
database_typeselect (postgresql, mysql, sqlite)NopostgresqlDatabase type to connect to
connection_stringstringNo-Database connection string
hoststringNo-Database host
portnumberNo-Database port
databasestringNo-Database name
userstringNo-Database username
passwordstringNo-Database password
fetchselect (all, one, none)NoallHow many rows to return from the query

Output:

FieldTypeDescription
rowsarrayWiersze wynikow zapytania
row_countnumberWiersze wynikow zapytania
columnsarrayWiersze wynikow zapytania

Example: Select with parameters

yaml
query: SELECT * FROM users WHERE status = $1
params: ["active"]
database_type: postgresql

Aktualizacja bazy danych

database.update

Aktualizuj dane w tabelach bazy danych

Parameters:

NameTypeRequiredDefaultDescription
tablestringYes-Name of the table
dataobjectYes-Data to insert or update
whereobjectYes-WHERE conditions (column: value for equality)
database_typeselect (postgresql, mysql, sqlite)NopostgresqlDatabase type to connect to
connection_stringstringNo-Database connection string
hoststringNo-Database host
portnumberNo-Database port
databasestringNo-Database name
userstringNo-Database username
passwordstringNo-Database password

Output:

FieldTypeDescription
updated_countnumberLiczba zaktualizowanych wierszy

Example: Update user status

yaml
table: users
data: {"status": "active"}
where: {"id": 123}
database_type: postgresql

MongoDB Find

db.mongodb.find

Zapytaj dokumenty z kolekcji MongoDB

Parameters:

NameTypeRequiredDefaultDescription
connection_stringstringNo-MongoDB connection string (defaults to env.MONGODB_URL)
databasestringYes-Database name
collectionstringYes-Collection name
filterobjectNo{}MongoDB query filter (empty object {} returns all)
projectionobjectNo-Fields to include/exclude in results
limitnumberNo100Maximum number of documents to return
sortobjectNo-Sort order (1 for ascending, -1 for descending)

Output:

FieldTypeDescription
documentsarrayTablica pasujacych dokumentow
countnumberTablica pasujacych dokumentow

Example: Find all active users

yaml
database: myapp
collection: users
filter: {"status": "active"}
limit: 50

Example: Find with projection and sort

yaml
database: myapp
collection: orders
filter: {"total": {"$gt": 100}}
projection: {"_id": 0, "order_id": 1, "total": 1, "created_at": 1}
sort: {"created_at": -1}
limit: 20

MongoDB Insert

db.mongodb.insert

Wstaw jeden lub wiecej dokumentow do kolekcji MongoDB

Parameters:

NameTypeRequiredDefaultDescription
connection_stringstringNo-MongoDB connection string (defaults to env.MONGODB_URL)
databasestringYes-Database name
collectionstringYes-Collection name
documentobjectNo-Document to insert (for single insert)
documentsarrayNo-Array of documents to insert (for bulk insert)

Output:

FieldTypeDescription
inserted_countnumberLiczba wstawionych dokumentow
inserted_idsarrayLiczba wstawionych dokumentow

Example: Insert single document

yaml
database: myapp
collection: users
document: {"name": "John Doe", "email": "john@example.com", "created_at": "${timestamp}"}

Example: Insert multiple documents

yaml
database: myapp
collection: products
documents: [{"name": "Product A", "price": 19.99}, {"name": "Product B", "price": 29.99}]

Zapytanie MySQL

db.mysql.query

Wykonaj zapytanie SQL na bazie danych MySQL i zwroc wyniki

Parameters:

NameTypeRequiredDefaultDescription
hoststringNo-Database host
portnumberNo3306Database port
userstringNo-Database username
passwordstringNo-Database password
databasestringNo-Database name
querystringYes-SQL query to execute
paramsarrayNo[]Parameters for parameterized queries (prevents SQL injection)

Output:

FieldTypeDescription
rowsarrayTablica wierszy wynikow jako obiekty
row_countnumberTablica wierszy wynikow jako obiekty
columnsarrayTablica wierszy wynikow jako obiekty

Example: Select products

yaml
query: SELECT id, name, price FROM products WHERE stock > 0 ORDER BY price DESC LIMIT 20

Example: Parameterized query

yaml
query: SELECT * FROM orders WHERE customer_id = %s AND created_at > %s
params: ["${customer_id}", "2024-01-01"]

Zapytanie PostgreSQL

db.postgresql.query

Wykonaj zapytanie SQL na bazie danych PostgreSQL i zwroc wyniki

Parameters:

NameTypeRequiredDefaultDescription
connection_stringstringNo-Database connection string
querystringYes-SQL query to execute
paramsarrayNo[]Parameters for parameterized queries (prevents SQL injection)

Output:

FieldTypeDescription
rowsarrayTablica wierszy wynikow jako obiekty
row_countnumberTablica wierszy wynikow jako obiekty
columnsarrayTablica wierszy wynikow jako obiekty

Example: Select users

yaml
query: SELECT id, email, created_at FROM users WHERE active = true LIMIT 10

Example: Parameterized query

yaml
query: SELECT * FROM orders WHERE user_id = $1 AND status = $2
params: ["${user_id}", "completed"]

Redis Get

db.redis.get

Pobierz wartosc z pamieci podreccznej Redis

Parameters:

NameTypeRequiredDefaultDescription
keystringYes-Redis key
hoststringNo-Redis host (from env.REDIS_HOST or explicit)
portnumberNo6379Redis port
dbnumberNo0Redis database number

Output:

FieldTypeDescription
valueanyZwrocona wartosc
existsbooleanZwrocona wartosc
keystringZwrocona wartosc

Example: Get cached value

yaml
key: user:123:profile
host: ${env.REDIS_HOST}

Example: Get from remote Redis

yaml
key: session:abc
host: redis.example.com
port: 6379
db: 1

Redis Set

db.redis.set

Ustaw wartosc w pamieci podrecznej Redis

Parameters:

NameTypeRequiredDefaultDescription
keystringYes-Redis key
valueanyYes-Value to store
ttlnumberNo-Time to live in seconds (optional)
hoststringNo-Redis host (from env.REDIS_HOST or explicit)
portnumberNo6379Redis port
dbnumberNo0Redis database number

Output:

FieldTypeDescription
successbooleanWhether the operation completed successfully
keystringKey identifier

Example: Cache user profile

yaml
key: user:123:profile
value: {"name": "John", "email": "john@example.com"}
ttl: 3600

Example: Set session data

yaml
key: session:abc
value: active
ttl: 1800
host: redis.example.com

Released under the Apache 2.0 License.