This example will create a service that inserts key and value into SQLite table. It's tested from command line.
Create a directory and then switch to it:
mkdir sqlite cd sqliteCopied!
Setup SQLite database in file "mydata.db":
echo 'drop table if exists key_value; create table if not exists key_value (key varchar(50) primary key, value varchar(100));' | sqlite3 mydata.dbCopied!
Create configuration file "mydb" that describes the SQLite database "mydata.db":
echo "$(pwd)/mydata.db"> mydbCopied!
Create the application:
sudo mgrg -i -u $(whoami) sqliteCopied!
Create file insert.golf:
vim insert.golfCopied!
Copy and paste to it (note use of database configuration "mydb" in @mydb):
%% /insert public get-param key get-param value run-query @mydb = "insert into key_value(key,value) values ('%s', '%s')" input key, value error err affected-rows aff_rows no-loop @Error <<print-out err>>, affected rows <<print-out aff_rows>> %%Copied!
Compile the application - we specify that file "mydb" is describing SQLite database: