repository

package
v0.0.0-...-0e4e588 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDbPool

func GetDbPool() *sql.DB

Types

type Channel

type Channel struct {
	ID          int       `json:"id,omitempty"`
	ChannelId   string    `json:"channel_id,omitempty"`
	ChannelName string    `json:"channel_name,omitempty"`
	Type        string    `json:"type,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type ChannelRepository

type ChannelRepository interface {
	Create(channel *Channel) (*Channel, error)
	Get(id int) (*Channel, error)
}

type Channels

type Channels map[int]*Channel

type MysqlChannelRepository

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

func NewMysqlChannelRepository

func NewMysqlChannelRepository(ctx context.Context, db *sql.DB) *MysqlChannelRepository

func (*MysqlChannelRepository) Create

func (r *MysqlChannelRepository) Create(channel *Channel) (*Channel, error)

func (*MysqlChannelRepository) Get

func (r *MysqlChannelRepository) Get(id int) (*Channel, error)

func (*MysqlChannelRepository) GetByOffset

func (r *MysqlChannelRepository) GetByOffset(offset int, limit int) (*Channels, error)

type MysqlPhrasesRepository

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

func NewMysqlPhrasesRepository

func NewMysqlPhrasesRepository(ctx context.Context, db *sql.DB) *MysqlPhrasesRepository

func (MysqlPhrasesRepository) Create

func (r MysqlPhrasesRepository) Create(phrase *Phrase) (*Phrase, error)

func (MysqlPhrasesRepository) Get

func (r MysqlPhrasesRepository) Get(id int) (*Phrase, error)

func (*MysqlPhrasesRepository) GetByOffset

func (r *MysqlPhrasesRepository) GetByOffset(offset int, limit int) (*Phrases, error)

func (MysqlPhrasesRepository) GetPhrasesByUserId

func (r MysqlPhrasesRepository) GetPhrasesByUserId(senderId string) (*Phrases, error)

func (MysqlPhrasesRepository) GetTop

func (r MysqlPhrasesRepository) GetTop(channelId string, count int) ([]*TopElement, error)

type MysqlUserWisdomRepository

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

func UserWisdomRepository

func UserWisdomRepository(ctx context.Context, db *sql.DB) *MysqlUserWisdomRepository

func (MysqlUserWisdomRepository) Create

func (MysqlUserWisdomRepository) Get

func (r MysqlUserWisdomRepository) Get(authorId string, count int) ([]*WisdomPhrase, error)

type Phrase

type Phrase struct {
	ID              int       `json:"id,omitempty"`
	SenderChannelId string    `json:"sender_chan_id,omitempty"`
	SenderId        string    `json:"sender_id,omitempty"`
	SenderName      string    `json:"sender_name,omitempty"`
	PhraseText      string    `json:"phrase,omitempty"`
	Reply           string    `json:"reply_id,omitempty"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

type PhraseRepository

type PhraseRepository interface {
	Create(phrase *Phrase) (*Phrase, error)
	Get(id int) (*Phrase, error)
}

type Phrases

type Phrases map[int]*Phrase

type TopElement

type TopElement struct {
	Name  string
	Count int
}

type WisdomPhrase

type WisdomPhrase struct {
	ID       int    `json:"id,omitempty"`
	Text     string `json:"text,omitempty"`
	AuthorId string `json:"author,omitempty"`
}

type WisdomPhrases

type WisdomPhrases map[int]*WisdomPhrase

Jump to

Keyboard shortcuts

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