add db
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package postgres
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
"git.3crabs.ru/VLADIMIR/butler/internal/modules/storage"
|
||||
)
|
||||
|
||||
type storagePostgres struct {
|
||||
db *sql.DB
|
||||
}
|
||||
|
||||
func NewStoragePostgres(urlConnect string) (storage.IStorage, error) {
|
||||
db, err := sql.Open("postgres", urlConnect)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &storagePostgres{db: db}, nil
|
||||
}
|
||||
|
||||
func (s *storagePostgres) GetAllUsersByChatID(ctx context.Context, chatID string) ([]storage.User, error) {
|
||||
// TODO: imptement
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *storagePostgres) UpsertUser(ctx context.Context, user storage.User) error {
|
||||
// TODO: imptement
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *storagePostgres) Close() {
|
||||
s.db.Close()
|
||||
}
|
||||
Reference in New Issue
Block a user