Skip to content

Commit 2e4b6ef

Browse files
docs: documentation CONTRIBUTING.md
1 parent 7058872 commit 2e4b6ef

File tree

1 file changed

+89
-1
lines changed

1 file changed

+89
-1
lines changed

README.md

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,89 @@
1-
# sqlc-generate-sql-crud
1+
# sqlc generate crud
2+
3+
is a library that generates CRUD in sql operations for a struct using.
4+
5+
## Case of use
6+
7+
was created in order to decrease the time spent writing queries using the sqlc: A SQL Compiler.
8+
[sqlc](https://sqlc.dev/)
9+
10+
11+
## Installation
12+
13+
```bash
14+
go get github.com/Paulo-Lopes-Estevao/sqlc-generate-crud
15+
```
16+
17+
## Usage
18+
19+
### Required create a file sqlc.yaml
20+
21+
```yaml
22+
version: "2"
23+
sql:
24+
- schema: "postgresql/schema.sql"
25+
queries: "postgresql"
26+
engine: "postgresql"
27+
gen:
28+
go:
29+
package: "authors"
30+
out: "postgresql"
31+
```
32+
33+
> generated sql files will be saved in the queries path folder in the sqlc.yaml file
34+
35+
function Generate has 2 parameters:
36+
37+
- **data** : struct that will be used to generate the CRUD operations
38+
- **options** : struct that will be used to configure the generation _tag_ and _pathTarget_
39+
40+
```golang
41+
// GenerateConfig is a struct that will be used to configure the generation
42+
type GenerateConfig struct {
43+
Tag string
44+
PathTarget string
45+
}
46+
```
47+
48+
### Example
49+
50+
```golang
51+
package main
52+
53+
import (
54+
"github.com/Paulo-Lopes-Estevao/sqlc-generate-crud"
55+
)
56+
57+
type User struct {
58+
ID int64 `json:"id"`
59+
Name string `json:"name"`
60+
Email string `json:"email"`
61+
}
62+
63+
func main() {
64+
err := sqlcgeneratecrud.Generate(User{}, &sqlcgeneratecrud.GenerateConfig{})
65+
if err != nil {
66+
panic(err)
67+
}
68+
}
69+
```
70+
71+
72+
73+
## Contributing
74+
75+
Before opening an issue or pull request, please check the project's contribution documents.
76+
77+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details about our code of conduct, and the process for submitting pull requests.
78+
79+
## Support Donate
80+
81+
If you find this project useful, you can buy author a glass of juice 🧃
82+
83+
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/E1E2L169R)
84+
85+
also a coffee ☕️
86+
87+
<a href="https://www.buymeacoffee.com/pl1745240p" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
88+
89+
will be very grateful to you for your support 😊.

0 commit comments

Comments
 (0)