Simple SQL
We support sqlite and postgres. And we make heavy use of: map[string]any
This means you do not have to make a struct for each table. You do NOT have to worry about nil (NULL) things by default. When you call c.All("user", "order by id", "") you get back just 30 rows. c.All("user", "order by id", offsetString) empty string means offset 0.
Do you have to cast a lot of any's to strings and stuff? Enter BaseModel to the rescue.
To upsert something we use c.Params. All the json sent in the body of a POST can be ready into c.Params with c.ReadJsonBodyIntoParams. Using the regex validations set in feedback.json c.ValidateAndInsert will return an string error or empty string "" if none. You will also find c.Params["guid"] now contains the new uuid generated for this row.
You can select just one row with: c.One("user", "where id=$1", c.User["id"])
You can select anything with: c.FreeFormSelect("select * from users where id=$1", c.User["id"])
There is also FreeFormUpdate: c.FreeFormUpdate("update users set email=$1 where id=$2", "", c.User["id"])
Copyright © 2024
All right reserved by