Quickstart
Init Project
First, use go mod init
to initialize the project and add GoooQo by:
Then, initialize the database connection and transaction manager as follows:
Build DataAccess
Suppose we have the following user table in test.db
:
id
name
score
memo
1
Alley
80
Good
2
Dave
75
Well
3
Bob
60
4
Tim
92
Great
5
Emy
100
Great
We define an entity object and a query object for the table:
user.go
The fields of the entity object correspond to the columns of the table, and the fields of the query object are based on the query conditions of the requirements.
Then we define a userDataAccess
to access the table:
This will generate and execute the following SQL:
Related Documents
Last updated