Muezz
04/16/2022, 7:31 PMDataModel
into a json document using a toMap()
method defined by me. I pass that document to the insert statement like this:
dart
addTransaction(DataModel data) {
var response = _databaseService
.insert(
data.toMap(),
)
.execute();
return response;
}
I want to do the same thing but in a Stored Procedure
like this:
dart
addTransaction(DataModel data) {
var response = _databaseService
.rpc(
data.toMap(),
)
.execute();
return response;
}
What would be the name of the object type while defining this function? I cannot find json in the intellisense. The reason I want to do this is to be able to add some data from the json document in one table and the rest of the data in another table in one go.Needle
04/16/2022, 7:32 PM/title
command!
We have solved your problem?
Click the button below to archive it.Vinzent
04/16/2022, 7:35 PMdart
or in postgres
?Needle
04/16/2022, 7:35 PMMuezz
04/16/2022, 7:40 PMStored Procedure
that can be executed directly from dart using the rpc
command i.e. the one written in plpgsql
Muezz
04/16/2022, 7:40 PMtype
of the argument.Vinzent
04/16/2022, 7:40 PMjsonb
Muezz
04/16/2022, 7:41 PMVinzent
04/16/2022, 7:43 PMMuezz
04/16/2022, 7:45 PMVinzent
04/16/2022, 7:46 PMjsonb
is listed there, isn't it?Muezz
04/16/2022, 7:48 PMjsonb
Vinzent
04/16/2022, 7:48 PMMuezz
04/16/2022, 7:50 PMMuezz
04/16/2022, 8:11 PMplpgsql
INSERT
calls, you have to define the values you will be inserting as well as the names of the columns that will be getting those values. How do I make the INSERT
call figure out on its own that it is getting a json doc where the keys are the column names and the values are the values that need to be inserted?Muezz
04/16/2022, 8:13 PMINSERT
call looks likeVinzent
04/16/2022, 8:16 PMMuezz
04/16/2022, 8:17 PMVinzent
04/16/2022, 8:18 PMMuezz
04/16/2022, 8:20 PMVinzent
04/16/2022, 8:26 PMMuezz
04/16/2022, 8:38 PMMuezz
04/16/2022, 8:39 PMMuezz
04/16/2022, 8:39 PM