Documentation ¶
Overview ¶
Link entity
Index ¶
- Constants
- Variables
- type CreateLinkError
- type Link
- type LinkBuilder
- func (b *LinkBuilder) Build() (*Link, error)
- func (b *LinkBuilder) SetCreatedAt(createdAt time.Time) *LinkBuilder
- func (b *LinkBuilder) SetDescribe(describe string) *LinkBuilder
- func (b *LinkBuilder) SetURL(newURL string) *LinkBuilder
- func (b *LinkBuilder) SetUpdatedAt(updatedAt time.Time) *LinkBuilder
- type LinkEvent
- type Links
- type NotFoundByHashError
- type NotFoundError
- type NotUniqError
- type PermissionDeniedError
- type Time
- type Url
Constants ¶
const ( // MQ_EVENT_LINK_NEW - subscribe on request created link MQ_EVENT_LINK_NEW = "shortlink.link.event.new" // MQ_EVENT_LINK_CREATED - subscribe on a created link MQ_EVENT_LINK_CREATED = "shortlink.link.event.created" )
MQ events
Variables ¶
var ( // METHOD_ADD - new link created METHOD_ADD = notify.NewEventID() // METHOD_GET - get link METHOD_GET = notify.NewEventID() // METHOD_LIST - get links METHOD_LIST = notify.NewEventID() // METHOD_UPDATE - update link METHOD_UPDATE = notify.NewEventID() // METHOD_DELETE - delete link from system METHOD_DELETE = notify.NewEventID() )
Link CRUD methods
var ( LinkEvent_name = map[int32]string{ 0: "LINK_EVENT_UNSPECIFIED", 1: "LINK_EVENT_ADD", 2: "LINK_EVENT_GET", 3: "LINK_EVENT_LIST", 4: "LINK_EVENT_UPDATE", 5: "LINK_EVENT_DELETE", } LinkEvent_value = map[string]int32{ "LINK_EVENT_UNSPECIFIED": 0, "LINK_EVENT_ADD": 1, "LINK_EVENT_GET": 2, "LINK_EVENT_LIST": 3, "LINK_EVENT_UPDATE": 4, "LINK_EVENT_DELETE": 5, } )
Enum value maps for LinkEvent.
var File_domain_link_v1_link_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type CreateLinkError ¶
type CreateLinkError struct {
Link *Link
}
CreateLinkError - failed create link
func (*CreateLinkError) Error ¶
func (e *CreateLinkError) Error() string
type Link ¶
type Link struct {
// contains filtered or unexported fields
}
Link is a domain model.
func (*Link) GetCreatedAt ¶
GetCreatedAt returns the value of the createdAt field.
func (*Link) GetDescribe ¶
GetDescribe returns the value of the described field.
func (*Link) GetUpdatedAt ¶
GetUpdatedAt returns the value of the updatedAt field.
type LinkBuilder ¶
type LinkBuilder struct {
// contains filtered or unexported fields
}
LinkBuilder is used to build a new Link
func NewLinkBuilder ¶
func NewLinkBuilder() *LinkBuilder
NewLinkBuilder returns a new instance of LinkBuilder
func (*LinkBuilder) Build ¶
func (b *LinkBuilder) Build() (*Link, error)
Build finalizes the building process and returns the built Link
func (*LinkBuilder) SetCreatedAt ¶
func (b *LinkBuilder) SetCreatedAt(createdAt time.Time) *LinkBuilder
SetCreatedAt sets the creation timestamp of the link
func (*LinkBuilder) SetDescribe ¶
func (b *LinkBuilder) SetDescribe(describe string) *LinkBuilder
SetDescribe sets the description of the link
func (*LinkBuilder) SetURL ¶
func (b *LinkBuilder) SetURL(newURL string) *LinkBuilder
SetURL sets the URL of the link and calculates the hash
func (*LinkBuilder) SetUpdatedAt ¶
func (b *LinkBuilder) SetUpdatedAt(updatedAt time.Time) *LinkBuilder
SetUpdatedAt sets the update timestamp of the link
type LinkEvent ¶
type LinkEvent int32
Link event
const ( // Unspecified LinkEvent_LINK_EVENT_UNSPECIFIED LinkEvent = 0 // Add link LinkEvent_LINK_EVENT_ADD LinkEvent = 1 // Get link LinkEvent_LINK_EVENT_GET LinkEvent = 2 // List link LinkEvent_LINK_EVENT_LIST LinkEvent = 3 // Update link LinkEvent_LINK_EVENT_UPDATE LinkEvent = 4 // Delete link LinkEvent_LINK_EVENT_DELETE LinkEvent = 5 )
func (LinkEvent) Descriptor ¶
func (LinkEvent) Descriptor() protoreflect.EnumDescriptor
func (LinkEvent) EnumDescriptor
deprecated
func (LinkEvent) Number ¶
func (x LinkEvent) Number() protoreflect.EnumNumber
func (LinkEvent) Type ¶
func (LinkEvent) Type() protoreflect.EnumType
type Links ¶
type Links struct {
// contains filtered or unexported fields
}
Link list
type NotFoundByHashError ¶
type NotFoundByHashError struct {
Hash string
}
NotFoundByHashError - not found link by hash
func (*NotFoundByHashError) Error ¶
func (e *NotFoundByHashError) Error() string
type NotFoundError ¶
type NotFoundError struct {
Link *Link
}
NotFoundError - not found link
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type NotUniqError ¶
type NotUniqError struct {
Link *Link
}
NotUniqError - not uniq link
func (*NotUniqError) Error ¶
func (e *NotUniqError) Error() string
type PermissionDeniedError ¶
type PermissionDeniedError struct {
Err error
}
PermissionDeniedError - permission denied
func (*PermissionDeniedError) Error ¶
func (e *PermissionDeniedError) Error() string
type Time ¶
func (Time) GetTimestamp ¶
func (t Time) GetTimestamp() *timestamppb.Timestamp
type Url ¶
func (Url) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Url) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.