feat: add register agent in db

This commit is contained in:
lorsan
2026-04-16 13:38:35 +03:00
parent 65d8f883dc
commit 52766cf7e8
16 changed files with 271 additions and 29 deletions
+21
View File
@@ -0,0 +1,21 @@
package store
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/lorsanstand/HomeOps-Hub/internal/hub/store/sqlc/gen"
)
type HubStore struct {
queries *gen.Queries
}
func NewHubStore(db *pgxpool.Pool) *HubStore {
queries := gen.New(db)
return &HubStore{queries}
}
func (h *HubStore) NewAgent(ctx context.Context, agent Agent) error {
return h.queries.CreateAgent(ctx, toDBAgent(agent))
}