butler/internal/modules/storage/postgres/postgres.go

37 lines
700 B
Go

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()
}