Documentation
¶
Overview ¶
Package dto — table-driven generic-based DTO transfers for kaname (parity with services/vpc/internal/dto/base.go).
Layout:
- dto/base.go (this file): generic Interface, RegTransfer / FindTransfer, FromTo helper, Transfer entry-point with type-set generic constraint (Transferrable).
- dto/toproto/*.go: implementations of Interface[domain.X, *iamv1.X] + init()-time registration in the registry.
Usage (caller-site):
var dst *iamv1.Account
if err := dto.Transfer(dto.FromTo(d, &dst)); err != nil { ... }
return anypb.New(dst)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegTransfer ¶
RegTransfer регистрирует трансфер F → T под ключом reflect.TypeFor[tag[F,T]].
func Transfer ¶
func Transfer[V Transferrable](dto V) error
Transfer запускает Perform() на dto. Единственная публичная entry-point.
Types ¶
type DTO ¶
DTO — pair-объект, который собирает FromTo(): хранит src + указатель на dst и реализует Perform() через registry-lookup.
type Transferrable ¶
type Transferrable interface {
Perform() error
*DTO[time.Time, *timestamppb.Timestamp] |
*DTO[domain.Account, *iamv1.Account] |
*DTO[domain.Project, *iamv1.Project] |
*DTO[domain.User, *iamv1.User] |
*DTO[domain.ServiceAccount, *iamv1.ServiceAccount] |
*DTO[domain.Group, *iamv1.Group] |
*DTO[domain.GroupMember, *iamv1.GroupMember] |
*DTO[domain.Role, *iamv1.Role] |
*DTO[domain.AccessBinding, *iamv1.AccessBinding]
}
Transferrable — closed type-set generic constraint for Transfer(). Accepts only those `*DTO[F,T]` pairs that are **explicitly** registered in the type-set below. New pairs are added here as new domain↔proto mappings are introduced.
Click to show internal directories.
Click to hide internal directories.