database

package
v0.0.0-...-82988be Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateFeedFollowParams

type CreateFeedFollowParams struct {
	ID        uuid.UUID `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	FeedID    uuid.UUID `json:"feed_id"`
	UserID    uuid.UUID `json:"user_id"`
}

type CreateFeedParams

type CreateFeedParams struct {
	ID          uuid.UUID `json:"id"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	UserID      uuid.UUID `json:"user_id"`
	Url         string    `json:"url"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
}

type CreatePostParams

type CreatePostParams struct {
	ID          uuid.UUID `json:"id"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	FeedID      uuid.UUID `json:"feed_id"`
	Title       string    `json:"title"`
	Url         string    `json:"url"`
	Description string    `json:"description"`
	PublishDate time.Time `json:"publish_date"`
}

type CreateUserParams

type CreateUserParams struct {
	ID        uuid.UUID `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Name      string    `json:"name"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteFeedFollowParams

type DeleteFeedFollowParams struct {
	FeedID uuid.UUID `json:"feed_id"`
	UserID uuid.UUID `json:"user_id"`
}

type Feed

type Feed struct {
	ID            uuid.UUID    `json:"id"`
	CreatedAt     time.Time    `json:"created_at"`
	UpdatedAt     time.Time    `json:"updated_at"`
	UserID        uuid.UUID    `json:"user_id"`
	Url           string       `json:"url"`
	Title         string       `json:"title"`
	Description   string       `json:"description"`
	LastFetchedAt sql.NullTime `json:"last_fetched_at"`
}

type FeedFollow

type FeedFollow struct {
	ID        uuid.UUID `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	FeedID    uuid.UUID `json:"feed_id"`
	UserID    uuid.UUID `json:"user_id"`
}

type GetFeedFollowsParams

type GetFeedFollowsParams struct {
	FeedID uuid.UUID `json:"feed_id"`
	UserID uuid.UUID `json:"user_id"`
}

type GetPostsByFeedIDParams

type GetPostsByFeedIDParams struct {
	FeedID uuid.UUID `json:"feed_id"`
	Offset int32     `json:"offset"`
	Limit  int32     `json:"limit"`
}

type GetPostsByUserParams

type GetPostsByUserParams struct {
	UserID uuid.UUID `json:"user_id"`
	Offset int32     `json:"offset"`
	Limit  int32     `json:"limit"`
}

type MarkFeedAsFetchedParams

type MarkFeedAsFetchedParams struct {
	ID            uuid.UUID    `json:"id"`
	LastFetchedAt sql.NullTime `json:"last_fetched_at"`
	UpdatedAt     time.Time    `json:"updated_at"`
}

type Post

type Post struct {
	ID          uuid.UUID `json:"id"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	FeedID      uuid.UUID `json:"feed_id"`
	Title       string    `json:"title"`
	Url         string    `json:"url"`
	Description string    `json:"description"`
	PublishDate time.Time `json:"publish_date"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateFeed

func (q *Queries) CreateFeed(ctx context.Context, arg CreateFeedParams) (Feed, error)

func (*Queries) CreateFeedFollow

func (q *Queries) CreateFeedFollow(ctx context.Context, arg CreateFeedFollowParams) (FeedFollow, error)

func (*Queries) CreatePost

func (q *Queries) CreatePost(ctx context.Context, arg CreatePostParams) (Post, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) DeleteFeedFollow

func (q *Queries) DeleteFeedFollow(ctx context.Context, arg DeleteFeedFollowParams) error

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, id uuid.UUID) error

func (*Queries) GetFeedByID

func (q *Queries) GetFeedByID(ctx context.Context, id uuid.UUID) (Feed, error)

func (*Queries) GetFeedByURL

func (q *Queries) GetFeedByURL(ctx context.Context, url string) (Feed, error)

func (*Queries) GetFeedFollows

func (q *Queries) GetFeedFollows(ctx context.Context, arg GetFeedFollowsParams) (FeedFollow, error)

func (*Queries) GetFeedFollowsByUser

func (q *Queries) GetFeedFollowsByUser(ctx context.Context, userID uuid.UUID) ([]Feed, error)

func (*Queries) GetFeeds

func (q *Queries) GetFeeds(ctx context.Context) ([]Feed, error)

func (*Queries) GetNextFeedsToFetch

func (q *Queries) GetNextFeedsToFetch(ctx context.Context, limit int32) ([]Feed, error)

func (*Queries) GetPostByURL

func (q *Queries) GetPostByURL(ctx context.Context, url string) (Post, error)

func (*Queries) GetPostsByFeedID

func (q *Queries) GetPostsByFeedID(ctx context.Context, arg GetPostsByFeedIDParams) ([]Post, error)

func (*Queries) GetPostsByUser

func (q *Queries) GetPostsByUser(ctx context.Context, arg GetPostsByUserParams) ([]Post, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, apiKey string) (User, error)

func (*Queries) GetUserByName

func (q *Queries) GetUserByName(ctx context.Context, name string) (User, error)

func (*Queries) GetUsers

func (q *Queries) GetUsers(ctx context.Context) ([]User, error)

func (*Queries) MarkFeedAsFetched

func (q *Queries) MarkFeedAsFetched(ctx context.Context, arg MarkFeedAsFetchedParams) (Feed, error)

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type UpdateUserParams

type UpdateUserParams struct {
	ID        uuid.UUID `json:"id"`
	UpdatedAt time.Time `json:"updated_at"`
	Name      string    `json:"name"`
}

type User

type User struct {
	ID        uuid.UUID `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Name      string    `json:"name"`
	ApiKey    string    `json:"api_key"`
}

Jump to

Keyboard shortcuts

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