v1

package
v0.0.0-...-d618348 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Link entity

Index

Constants

View Source
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

View Source
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

View Source
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.

View Source
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 struct {
	// contains filtered or unexported fields
}

Link is a domain model.

func (*Link) GetCreatedAt

func (m *Link) GetCreatedAt() Time

GetCreatedAt returns the value of the createdAt field.

func (*Link) GetDescribe

func (m *Link) GetDescribe() string

GetDescribe returns the value of the described field.

func (*Link) GetHash

func (m *Link) GetHash() string

GetHash returns the value of the hash field.

func (*Link) GetUpdatedAt

func (m *Link) GetUpdatedAt() Time

GetUpdatedAt returns the value of the updatedAt field.

func (*Link) GetUrl

func (m *Link) GetUrl() *Url

GetUrl returns the value of the url 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) Enum

func (x LinkEvent) Enum() *LinkEvent

func (LinkEvent) EnumDescriptor deprecated

func (LinkEvent) EnumDescriptor() ([]byte, []int)

Deprecated: Use LinkEvent.Descriptor instead.

func (LinkEvent) Number

func (x LinkEvent) Number() protoreflect.EnumNumber

func (LinkEvent) String

func (x LinkEvent) String() string

func (LinkEvent) Type

type Links struct {
	// contains filtered or unexported fields
}

Link list

func NewLinks() *Links

func (*Links) Count

func (m *Links) Count() int

Count returns the number of links

func (m *Links) GetLinks() []*Link

GetLinks returns the value of the link field.

func (*Links) Len

func (l *Links) Len() int

func (*Links) Less

func (l *Links) Less(i, j int) bool

func (*Links) Push

func (l *Links) Push(link ...*Link)

Push adds a new Link to the link slice

func (*Links) Swap

func (l *Links) Swap(i, j int)

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

type Time time.Time

func (Time) GetTime

func (t Time) GetTime() time.Time

func (Time) GetTimestamp

func (t Time) GetTimestamp() *timestamppb.Timestamp

type Url

type Url struct {
	*url.URL
}

func (*Url) GetUrl

func (m *Url) GetUrl() *url.URL

func (Url) MarshalJSON

func (m Url) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Url) String

func (m *Url) String() string

func (*Url) UnmarshalJSON

func (m *Url) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL