Skip to content

Commit a6f5714

Browse files
committed
2 parents 92f14a0 + 0b57d7b commit a6f5714

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# repoImpl
1+
# repoimpl
22
Repositories, migrations and tests with model
33

44

@@ -10,21 +10,46 @@ The function writes table queries, repositories and tests for each model in the
1010
go get github.com/realtemirov/repoimpl
1111
```
1212

13-
## Migrations
13+
## Repository
1414
```
1515
type User struct {
1616
Username string
1717
Password string
1818
}
1919
20-
err := repoImpl.NewDBTable(User{})
20+
err := repoimpl.NewRepository(User{})
2121
if err != nil {
2222
panic(err)
2323
}
2424
```
25+
Repository implement CRUD to *postgres* database with sql package and creates **interface storage**
2526

27+
```
28+
go run main.go
29+
```
30+
├─ repository \
31+
  ─ postgres \
32+
   ─ user.go - CRUD methods \
33+
  ─ storage.go - CRUD interfaces
2634

35+
## Migrations
36+
```
37+
type User struct {
38+
Username string
39+
Password string
40+
}
41+
42+
err := repoimpl.NewMigration(User{})
43+
if err != nil {
44+
panic(err)
45+
}
46+
```
2747
Creates **migration_user.sql** in the **migrations** folder
48+
49+
```
50+
go run main.go
51+
```
52+
2853
```
2954
CREATE TABLE IF NOT EXITS "users" (
3055
"username" TEXT,

0 commit comments

Comments
 (0)