upaas/internal/domain/types.go
user 75cad7d2ad
All checks were successful
Check / check (pull_request) Successful in 11m36s
refactor: add String() methods to domain types, replace string() casts
2026-02-23 11:58:00 -08:00

26 lines
965 B
Go

// Package domain defines domain-specific string types for compile-time safety.
// Using named types prevents accidentally passing the wrong string argument
// (e.g. a container ID where an image ID is expected).
package domain
// ImageID is a Docker image identifier (ID or tag).
type ImageID string
// String implements the fmt.Stringer interface.
func (id ImageID) String() string { return string(id) }
// ContainerID is a Docker container identifier.
type ContainerID string
// String implements the fmt.Stringer interface.
func (id ContainerID) String() string { return string(id) }
// UnparsedURL is a URL stored as a plain string without parsing.
// Use this instead of string when the value is known to be a URL
// but should not be parsed into a net/url.URL (e.g. webhook URLs,
// compare URLs from external payloads).
type UnparsedURL string
// String implements the fmt.Stringer interface.
func (u UnparsedURL) String() string { return string(u) }