domain

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MessageTypeDocument = MessageType{"message_type_document"}
	MessageTypePhoto    = MessageType{"message_type_photo"}
	MessageTypeTextOnly = MessageType{"message_type_text_only"}
)
View Source
var (
	TgFileTypePhoto    = TgFileType{"photo"}
	TgFileTypeDocument = TgFileType{"document"}
)
View Source
var EmptyFile = TgFile{}

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Id       string
	Hashtags []string
}

type ChannelMessage

type ChannelMessage struct {
	ID        string
	ChannelID string
}

func NewChannelMessage

func NewChannelMessage(messageID string, channelID string) (ChannelMessage, error)

type ChannelRepository

type ChannelRepository interface {
	Save(ctx context.Context, channel Channel) error
	GetChannelsByHashtags(ctx context.Context, hashtags []string) ([]Channel, error)
}

type Message

type Message struct {
	ID              MessageID
	Text            string
	Hashtags        []string
	ChannelMessages []ChannelMessage
}

func NewMessage

func NewMessage(id MessageID, text string, hashtags []string) (Message, error)

func (*Message) AddChannelMessage

func (m *Message) AddChannelMessage(channelMessage ChannelMessage)

type MessageID

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

func NewMessageIDFromInt64

func NewMessageIDFromInt64(value int64) (MessageID, error)

NewMessageIDFromInt64 build a new MessageID instance from a int64 value.

func NewMessageIDFromStr

func NewMessageIDFromStr(value string) (MessageID, error)

NewMessageIDFromInt64 build a new MessageID instance from a string value.

func (MessageID) String

func (m MessageID) String() string

func (MessageID) Value

func (m MessageID) Value() int64

type MessageRepository

type MessageRepository interface {
	Save(ctx context.Context, msg Message) error
	GetByID(ctx context.Context, messageID string) (Message, error)
}

type MessageType

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

func NewMessageTypeFromStr

func NewMessageTypeFromStr(val string) MessageType

func (MessageType) IsZero

func (mt MessageType) IsZero() bool

func (MessageType) Value

func (mt MessageType) Value() string

type TgFile

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

func NewTgFile

func NewTgFile(id string, tgFileType TgFileType) (TgFile, error)

func (TgFile) ID

func (f TgFile) ID() string

func (TgFile) IsZero

func (f TgFile) IsZero() bool

type TgFileType

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

type TgMessageSender

type TgMessageSender interface {
	SendMessageToTgChan(tgChanId, text, username, originMessageId string, tgFile TgFile) (ChannelMessage, error)
}

TgMessageSender is a Telegram message sender.

Jump to

Keyboard shortcuts

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