postgres

package
v0.0.0-...-cbb6929 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNoRows

func IsNoRows(err error) bool

func IsUniqueViolation

func IsUniqueViolation(err error) bool

Types

type ConnectionPool

type ConnectionPool struct {
	*pgxpool.Pool
}

func NewConnectionPool

func NewConnectionPool(ctx context.Context, conf config.PostgresConfig) (*ConnectionPool, error)

type GroupRepo

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

func NewGroupRepo

func NewGroupRepo(conn *ConnectionPool) *GroupRepo

func (*GroupRepo) CreateGroup

func (g *GroupRepo) CreateGroup(userID int64, telegramID int64, openAIModel string) error

func (*GroupRepo) GetGroupByTelegramID

func (g *GroupRepo) GetGroupByTelegramID(telegramID int64) (models.Group, error)

func (*GroupRepo) SetGroupOpenAIModel

func (g *GroupRepo) SetGroupOpenAIModel(telegramID int64, openAIModel string) error

type MessageRepo

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

func NewMessageRepo

func NewMessageRepo(conn *ConnectionPool) *MessageRepo

func (*MessageRepo) CreateMessage

func (m *MessageRepo) CreateMessage(telegramID int64, text string, topicID int64, sender string) error

func (*MessageRepo) GetMessagesByTopicID

func (m *MessageRepo) GetMessagesByTopicID(topicID int64, after time.Time, limit int) ([]models.Message, error)

type TopicRepo

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

func NewTopicRepo

func NewTopicRepo(conn *ConnectionPool) *TopicRepo

func (*TopicRepo) CreateTopic

func (t *TopicRepo) CreateTopic(threadID int64, groupID int64, name string, openaiModel string) error

func (*TopicRepo) DeleteTopicByThreadID

func (t *TopicRepo) DeleteTopicByThreadID(threadID int) error

func (*TopicRepo) GetTopicByThreadID

func (t *TopicRepo) GetTopicByThreadID(threadID int) (models.Topic, error)

type UserRepo

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

func NewUserRepo

func NewUserRepo(conn *ConnectionPool) *UserRepo

func (*UserRepo) CreateUser

func (u *UserRepo) CreateUser(telegramID int64) error

func (*UserRepo) GetUserByTelegramID

func (u *UserRepo) GetUserByTelegramID(telegramID int64) (models.User, error)

Jump to

Keyboard shortcuts

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