File tree Expand file tree Collapse file tree 10 files changed +38
-19
lines changed Expand file tree Collapse file tree 10 files changed +38
-19
lines changed Original file line number Diff line number Diff line change 1- # Database: Postgresql, Redis, etc.
2- This project shows the implementation of clients for postgresql, Redis and other databases in Golang.
1+ # Kit
2+ Set of common packages used by all or most projects in my repositories.
33
44## Table of Contents
55
6- - [ Implementation] ( #implementation )
6+ - [ Implementation examples ] ( #implementation-examples )
77 - [ Postgresql] ( #postgresql )
88 - [ Redis] ( #redis )
9+ - [ Testing] ( #testing )
910
10- ## Implementation
11+ ## Implementation examples
1112
1213### Postgresql
1314
14- See the examples already implemented in the folder ` /pgdb ` .
15+ See the examples already implemented in the folder ` /postgresql ` .
1516
1617### Redis
1718
18- See the examples already implemented in the folder ` /redisdb ` .
19+ See the examples already implemented in the folder ` /redis ` .
20+
21+ ### Testing
22+
23+ To run the tests simply execute the following command:
24+
25+ ``` shell
26+ make test
27+ ```
28+
29+ This will stop any containers defined by the compose file for tests if already running
30+ and then rebuild the containers using the compose file.
31+
32+ To down the containers simply execute the following command:
33+
34+ ``` shell
35+ make test-down
36+ ```
37+
38+ lairon14@gmail.com
39+ -- Lairon
Original file line number Diff line number Diff line change 1- module github.com/Lairon/db -go
1+ module github.com/laironacosta/kit -go
22
33go 1.16
44
@@ -7,5 +7,4 @@ require (
77 github.com/go-redis/redis/v8 v8.8.0
88 github.com/sirupsen/logrus v1.8.1
99 github.com/stretchr/testify v1.7.0
10- golang.org/x/sys v0.0.0-20210402192133-700132347e07 // indirect
1110)
Original file line number Diff line number Diff line change @@ -132,9 +132,8 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w
132132golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
133133golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
134134golang.org/x/sys v0.0.0-20210112080510-489259a85091 /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
135+ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc =
135136golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
136- golang.org/x/sys v0.0.0-20210402192133-700132347e07 h1:4k6HsQjxj6hVMsI2Vf0yKlzt5lXxZsMW1q0zaq2k8zY =
137- golang.org/x/sys v0.0.0-20210402192133-700132347e07 /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
138137golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 /go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo =
139138golang.org/x/text v0.3.0 /go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ =
140139golang.org/x/text v0.3.2 /go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk =
File renamed without changes.
Original file line number Diff line number Diff line change 11package main
22
33import (
4- "github.com/Lairon/db-go/pgdb"
54 "github.com/go-pg/pg/v10"
65 "github.com/go-pg/pg/v10/orm"
6+ pgKit "github.com/laironacosta/kit-go/postgresql"
77 log "github.com/sirupsen/logrus"
88)
99
@@ -33,7 +33,7 @@ func main() {
3333
3434func NewPgClient () * PgClient {
3535 return & PgClient {
36- db : pgdb .NewPgDB (& pg.Options {
36+ db : pgKit .NewPgDB (& pg.Options {
3737 User : "root" ,
3838 Password : "root" ,
3939 Database : "db-test" ,
Original file line number Diff line number Diff line change 1- package pgdb
1+ package postgresql
22
33import (
44 "github.com/go-pg/pg/v10"
Original file line number Diff line number Diff line change 1- package pgdb
1+ package postgresql
22
33import (
44 "github.com/go-pg/pg/v10"
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ package main
22
33import (
44 "context"
5- "github.com/Lairon/db-go/redisdb"
65 "github.com/go-redis/redis/v8"
6+ redisKit "github.com/laironacosta/kit-go/redis"
77 log "github.com/sirupsen/logrus"
88 "time"
99)
@@ -29,7 +29,7 @@ func main() {
2929
3030func NewRedisClient () * RedisClient {
3131 return & RedisClient {
32- db : redisdb .NewRedisDB (& redis.Options {
32+ db : redisKit .NewRedisDB (& redis.Options {
3333 Addr : "redis-test:6379" ,
3434 Password : "" , // no password set
3535 DB : 0 , // use default DB
Original file line number Diff line number Diff line change 1- package redisdb
1+ package redis
22
33import (
44 "context"
Original file line number Diff line number Diff line change 1- package redisdb
1+ package redis
22
33import (
44 "github.com/go-redis/redis/v8"
77)
88
99var redisOptions = & redis.Options {
10- Addr : "redis:6379" ,
10+ Addr : "redis-test :6379" ,
1111 Password : "" ,
1212 DB : 0 ,
1313}
You can’t perform that action at this time.
0 commit comments