refactor(store): sqlc override uuid→google/uuid.UUID (убирает pgtype boilerplate)

This commit is contained in:
2026-07-03 14:20:03 +07:00
parent 34bc49ee8c
commit 635b05361f
8 changed files with 65 additions and 62 deletions
+14 -13
View File
@@ -5,37 +5,38 @@
package db
import (
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
dto "github.com/vasyakrg/dns-autoresolver/internal/store/dto"
)
type CheckRun struct {
ID pgtype.UUID `json:"id"`
DomainID pgtype.UUID `json:"domain_id"`
ID uuid.UUID `json:"id"`
DomainID uuid.UUID `json:"domain_id"`
Result []byte `json:"result"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type Domain struct {
ID pgtype.UUID `json:"id"`
ProjectID pgtype.UUID `json:"project_id"`
ProviderAccountID pgtype.UUID `json:"provider_account_id"`
ID uuid.UUID `json:"id"`
ProjectID uuid.UUID `json:"project_id"`
ProviderAccountID uuid.UUID `json:"provider_account_id"`
ZoneName string `json:"zone_name"`
ZoneID string `json:"zone_id"`
TemplateID pgtype.UUID `json:"template_id"`
TemplateID *uuid.UUID `json:"template_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type Project struct {
ID pgtype.UUID `json:"id"`
UserID pgtype.UUID `json:"user_id"`
ID uuid.UUID `json:"id"`
UserID uuid.UUID `json:"user_id"`
Name string `json:"name"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type ProviderAccount struct {
ID pgtype.UUID `json:"id"`
ProjectID pgtype.UUID `json:"project_id"`
ID uuid.UUID `json:"id"`
ProjectID uuid.UUID `json:"project_id"`
Provider string `json:"provider"`
SecretEnc string `json:"secret_enc"`
Comment string `json:"comment"`
@@ -43,8 +44,8 @@ type ProviderAccount struct {
}
type Template struct {
ID pgtype.UUID `json:"id"`
ProjectID pgtype.UUID `json:"project_id"`
ID uuid.UUID `json:"id"`
ProjectID uuid.UUID `json:"project_id"`
Name string `json:"name"`
Doc *dto.TemplateDoc `json:"doc"`
Version int32 `json:"version"`
@@ -53,7 +54,7 @@ type Template struct {
}
type User struct {
ID pgtype.UUID `json:"id"`
ID uuid.UUID `json:"id"`
Email string `json:"email"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}