repository

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Init added in v0.11.0

func Init()

Types

type DBArticle added in v1.0.3

type DBArticle struct {
	Id        string    `db:"id"`
	FeedId    string    `db:"feed_id"`
	Title     string    `db:"title"`
	Source    string    `db:"source"`
	Author    string    `db:"author"`
	Link      string    `db:"link"`
	Tags      []string  `db:"tags"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

func NewArticle added in v1.0.3

func NewArticle(
	uuid pgtype.UUID,
	Feedid pgtype.UUID,
	title string,
	source string,
	author string,
	link string,
	tags []string,
	createdAt time.Time,
	updatedAt time.Time,
) *DBArticle

type DBChat added in v1.1.0

type DBChat struct {
	Id               string     `db:"id"`
	TelegramChatId   string     `db:"telegram_chat_id"`
	TelegramUserId   *string    `db:"telegram_user_id, omitempty"`
	TelegramThreadId *string    `db:"telegram_thread_id, omitempty"`
	Tags             []string   `db:"tags"`
	CreatedAt        time.Time  `db:"created_at"`
	UpdatedAt        time.Time  `db:"updated_at"`
	LastTimeParsed   *time.Time `db:"last_time_parsed"`
}

func NewChat added in v1.0.3

func NewChat(
	uuid pgtype.UUID,
	telegramChatId string,
	telegramUserId *string,
	telegramThreadId *string,
	tags []string,
	createdAt time.Time,
	updatedAt time.Time,
	lastTimeParsed *time.Time,
) *DBChat

type DBFeed added in v1.0.3

type DBFeed struct {
	Id        string    `db:"id"`
	Url       string    `db:"url"`
	Disabled  bool      `db:"disabled"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

func NewFeed added in v1.0.3

func NewFeed(
	uuid pgtype.UUID,
	url string,
	disabled bool,
	createdAt time.Time,
	updatedAt time.Time,
) *DBFeed

type IArticleRepository added in v0.12.0

type IArticleRepository interface {
	GetAll() []*DBArticle
	GetOne(uuid string) *DBArticle
	GetByTitle(title string) *DBArticle
	GetByFeedId(uuid string) []*DBArticle
	Create(feedId string, title string, source string, author string, link string, tags []string) *DBArticle
	Delete(uuid string) bool
	GetByChatAndTime(chatId string) []*DBArticle
}

type IChatRepository added in v0.11.0

type IChatRepository interface {
	GetAll() []*DBChat
	GetOne(uuid string) *DBChat
	GetByTelegramChatId(chatId string) *DBChat
	GetByTelegramChatIdAndThreadId(chatId string, threadId string) *DBChat
	Create(telegramChatId string, telegramUserId string, telegramThreadId string, tags []string) *DBChat
	Delete(uuid string) bool
	UpdateTags(uuid string, tags []string) bool
	UpdateParsed(uuid string) bool
}

type IFeedRepository added in v1.0.3

type IFeedRepository interface {
	GetAll() []*DBFeed
	GetAllActive() []*DBFeed
	GetOne(uuid string) *DBFeed
	Create(url string) *DBFeed
	Delete(uuid string) bool
	GetByChatId(uuid string) []*DBFeed
	LinkChatAndFeed(feedId string, chatId string) bool
	UnLinkChatAndFeed(feedId string, chatId string) bool
	DisableFeed(feedId string) bool
}

type MocksArticleRepository added in v1.0.3

type MocksArticleRepository struct {
	mock.Mock
}

func (*MocksArticleRepository) Create added in v1.0.3

func (m *MocksArticleRepository) Create(feedId string, title string, source string, author string, link string, tags []string) *DBArticle

func (*MocksArticleRepository) Delete added in v1.0.3

func (m *MocksArticleRepository) Delete(uuid string) bool

func (*MocksArticleRepository) GetAll added in v1.0.3

func (m *MocksArticleRepository) GetAll() []*DBArticle

func (*MocksArticleRepository) GetByChatAndTime added in v1.2.0

func (m *MocksArticleRepository) GetByChatAndTime(chatId string) []*DBArticle

func (*MocksArticleRepository) GetByFeedId added in v1.0.3

func (m *MocksArticleRepository) GetByFeedId(uuid string) []*DBArticle

func (*MocksArticleRepository) GetByTitle added in v1.0.3

func (m *MocksArticleRepository) GetByTitle(title string) *DBArticle

func (*MocksArticleRepository) GetOne added in v1.0.3

func (m *MocksArticleRepository) GetOne(uuid string) *DBArticle

type MocksChatRepository added in v1.1.0

type MocksChatRepository struct {
	mock.Mock
}

func (*MocksChatRepository) Create added in v1.1.0

func (m *MocksChatRepository) Create(telegramChatId string, telegramUserId string, telegramThreadId string, tags []string) *DBChat

func (*MocksChatRepository) Delete added in v1.1.0

func (m *MocksChatRepository) Delete(uuid string) bool

func (*MocksChatRepository) GetAll added in v1.1.0

func (m *MocksChatRepository) GetAll() []*DBChat

func (*MocksChatRepository) GetByChatId added in v1.1.0

func (m *MocksChatRepository) GetByChatId(uuid string) []string

func (*MocksChatRepository) GetByTelegramChatId added in v1.3.0

func (m *MocksChatRepository) GetByTelegramChatId(chatId string) *DBChat

func (*MocksChatRepository) GetByTelegramChatIdAndThreadId added in v1.5.3

func (m *MocksChatRepository) GetByTelegramChatIdAndThreadId(chatId string, threadId string) *DBChat

func (*MocksChatRepository) GetOne added in v1.1.0

func (m *MocksChatRepository) GetOne(uuid string) *DBChat

func (*MocksChatRepository) UpdateParsed added in v1.2.0

func (m *MocksChatRepository) UpdateParsed(uuid string) bool

func (*MocksChatRepository) UpdateTags added in v1.1.0

func (m *MocksChatRepository) UpdateTags(uuid string, tags []string) bool

type MocksFeedRepository added in v1.0.3

type MocksFeedRepository struct {
	mock.Mock
}

MOCKS

func (*MocksFeedRepository) Create added in v1.0.3

func (m *MocksFeedRepository) Create(url string) *DBFeed

func (*MocksFeedRepository) Delete added in v1.0.3

func (m *MocksFeedRepository) Delete(uuid string) bool

func (*MocksFeedRepository) DisableFeed added in v1.4.0

func (m *MocksFeedRepository) DisableFeed(feedId string) bool

func (*MocksFeedRepository) GetAll added in v1.0.3

func (m *MocksFeedRepository) GetAll() []*DBFeed

func (*MocksFeedRepository) GetAllActive added in v1.4.0

func (m *MocksFeedRepository) GetAllActive() []*DBFeed

func (*MocksFeedRepository) GetByChatId added in v1.1.0

func (m *MocksFeedRepository) GetByChatId(uuid string) []*DBFeed

func (*MocksFeedRepository) GetOne added in v1.0.3

func (m *MocksFeedRepository) GetOne(uuid string) *DBFeed

func (*MocksFeedRepository) LinkChatAndFeed added in v1.1.0

func (m *MocksFeedRepository) LinkChatAndFeed(feedId string, chatId string) bool

func (*MocksFeedRepository) UnLinkChatAndFeed added in v1.1.0

func (m *MocksFeedRepository) UnLinkChatAndFeed(feedId string, chatId string) bool

type SArticleRepository added in v1.0.3

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

func (*SArticleRepository) Create added in v1.0.3

func (rep *SArticleRepository) Create(feedId string, title string, source string, author string, link string, tags []string) *DBArticle

Create one article

func (*SArticleRepository) Delete added in v1.0.3

func (rep *SArticleRepository) Delete(uuid string) bool

Delete one article from the db

func (*SArticleRepository) GetAll added in v1.0.3

func (rep *SArticleRepository) GetAll() []*DBArticle

Return all Article in the DB

func (*SArticleRepository) GetByChatAndTime added in v1.2.0

func (rep *SArticleRepository) GetByChatAndTime(chatId string) []*DBArticle

Retrieve new Article based on chat last time parsed

func (*SArticleRepository) GetByFeedId added in v1.0.3

func (rep *SArticleRepository) GetByFeedId(uuid string) []*DBArticle

Return one article link to a feed

func (*SArticleRepository) GetByTitle added in v1.0.3

func (rep *SArticleRepository) GetByTitle(title string) *DBArticle

Return one Article by it's title

func (*SArticleRepository) GetOne added in v1.0.3

func (rep *SArticleRepository) GetOne(uuid string) *DBArticle

Return one Article, nil if not found

type SChatRepository added in v1.0.3

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

func (*SChatRepository) Create added in v1.0.3

func (rep *SChatRepository) Create(
	telegramChatId string,
	telegramUserId string,
	telegramThreadId string,
	tags []string,
) *DBChat

Create one chat

func (*SChatRepository) Delete added in v1.0.3

func (rep *SChatRepository) Delete(uuid string) bool

Delete one chat from the db

func (*SChatRepository) GetAll added in v1.0.3

func (rep *SChatRepository) GetAll() []*DBChat

Return all Chats in the DB

func (*SChatRepository) GetByTelegramChatId added in v1.3.0

func (rep *SChatRepository) GetByTelegramChatId(chatId string) *DBChat

Return one chat, nil if not found

func (*SChatRepository) GetByTelegramChatIdAndThreadId added in v1.5.3

func (rep *SChatRepository) GetByTelegramChatIdAndThreadId(chatId string, threadId string) *DBChat

Return one chat by it's id and thread id, nil if not found

func (*SChatRepository) GetOne added in v1.0.3

func (rep *SChatRepository) GetOne(uuid string) *DBChat

Return one chat, nil if not found

func (*SChatRepository) UpdateParsed added in v1.2.0

func (rep *SChatRepository) UpdateParsed(uuid string) bool

Update the parsed time

func (*SChatRepository) UpdateTags added in v1.1.0

func (rep *SChatRepository) UpdateTags(uuid string, tags []string) bool

Appends tags to chat

type SFeedRepository added in v1.0.3

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

func (*SFeedRepository) Create added in v1.0.3

func (rep *SFeedRepository) Create(url string) *DBFeed

Create one feed

func (*SFeedRepository) Delete added in v1.0.3

func (rep *SFeedRepository) Delete(uuid string) bool

Delete one feed from the db

func (*SFeedRepository) DisableFeed added in v1.4.0

func (rep *SFeedRepository) DisableFeed(feedId string) bool

func (*SFeedRepository) GetAll added in v1.0.3

func (rep *SFeedRepository) GetAll() []*DBFeed

Return all Feeds in the DB

func (*SFeedRepository) GetAllActive added in v1.4.0

func (rep *SFeedRepository) GetAllActive() []*DBFeed

Return only active feeds

func (*SFeedRepository) GetByChatId added in v1.1.0

func (rep *SFeedRepository) GetByChatId(uuid string) []*DBFeed

Return all Feeds in the DB

func (*SFeedRepository) GetOne added in v1.0.3

func (rep *SFeedRepository) GetOne(uuid string) *DBFeed

Return one feed, nil if not found

func (*SFeedRepository) LinkChatAndFeed added in v1.1.0

func (rep *SFeedRepository) LinkChatAndFeed(feedId string, chatId string) bool

Subscribed chat to a feed

func (*SFeedRepository) UnLinkChatAndFeed added in v1.1.0

func (rep *SFeedRepository) UnLinkChatAndFeed(feedId string, chatId string) bool

Delete one feed from the db

Jump to

Keyboard shortcuts

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