update README.md
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
5a3db147bf
commit
b9626aeebe
20
README.md
20
README.md
@ -3,7 +3,7 @@
|
|||||||
Example for For postgres
|
Example for For postgres
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package postgres
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -38,15 +38,25 @@ func Connect(cfg *PostgresConfig) (*sqlx.DB, error) {
|
|||||||
"application_name": cfg.AppName,
|
"application_name": cfg.AppName,
|
||||||
}
|
}
|
||||||
// may be needed for pbbouncer, needs to check
|
// may be needed for pbbouncer, needs to check
|
||||||
//dbConf.PreferSimpleProtocol = true
|
// dbConf.PreferSimpleProtocol = true
|
||||||
// register pgx conn
|
// register pgx conn
|
||||||
dsn := stdlib.RegisterConnConfig(dbConf)
|
dsn := stdlib.RegisterConnConfig(dbConf)
|
||||||
|
|
||||||
|
|
||||||
sql.Register("micro-wrapper-sql", wrapper.WrapDriver(
|
wrapper.DefaultMeterStatsInterval = 1 * time.Second
|
||||||
&stdlib.Driver{},
|
logger.DefaultLogger = logger.NewLogger(logger.WithLevel(logger.DebugLevel))
|
||||||
wrapper.Tracer(some.NewTracer()),
|
|
||||||
|
if err := logger.DefaultLogger.Init(); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sql.Register("micro-wrapper-sql", wrapper.NewWrapper(&sqlite.Driver{},
|
||||||
|
wrapper.DatabaseHost("localhost"),
|
||||||
|
wrapper.DatabaseName("mydb"),
|
||||||
|
wrapper.LoggerLevel(logger.DebugLevel),
|
||||||
|
wrapper.LoggerEnabled(true),
|
||||||
))
|
))
|
||||||
|
|
||||||
wdb, err := sql.Open("micro-wrapper-sql", dsn)
|
wdb, err := sql.Open("micro-wrapper-sql", dsn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user