Skip to content

Commit

Permalink
feat(database): remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
lianxmfor committed Oct 25, 2021
1 parent af8087f commit 6042179
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions internal/database/database.go
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
package database

import (
"fmt"

"github.com/jmoiron/sqlx"

_ "github.com/lib/pq"
)

type RowMap = map[string]interface{}

type DB struct {
*sqlx.DB
}

type Option struct {
Host string
Port string
User string
Pass string
DbName string
}

func Open(option Option) (*DB, error) {
return OpenWith(option.Host, option.Port, option.User, option.Pass, option.DbName)
}

func OpenWith(host, port, user, pass, dbName string) (*DB, error) {
db, err := sqlx.Open(
"postgres",
fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable",
user,
pass,
host,
port,
dbName),
)
return &DB{db}, err
}

0 comments on commit 6042179

Please sign in to comment.