From b9626aeebecf5e80319ad85f0ca53cc2c757e169 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 6 Jan 2023 23:42:34 +0300 Subject: [PATCH] update README.md Signed-off-by: Vasiliy Tolstov --- README.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0c00b23..5aaa3ac 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Example for For postgres ```go -package postgres +package storage import ( "fmt" @@ -38,15 +38,25 @@ func Connect(cfg *PostgresConfig) (*sqlx.DB, error) { "application_name": cfg.AppName, } // may be needed for pbbouncer, needs to check - //dbConf.PreferSimpleProtocol = true + // dbConf.PreferSimpleProtocol = true // register pgx conn dsn := stdlib.RegisterConnConfig(dbConf) - sql.Register("micro-wrapper-sql", wrapper.WrapDriver( - &stdlib.Driver{}, - wrapper.Tracer(some.NewTracer()), - )) + wrapper.DefaultMeterStatsInterval = 1 * time.Second + logger.DefaultLogger = logger.NewLogger(logger.WithLevel(logger.DebugLevel)) + + 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) if err != nil { return nil, err