database

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const PostsPerPage int = 25

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMediafileParams

type CreateMediafileParams struct {
	FileName      string
	FilePath      string
	FileType      string
	FileExtention string
	Thumbnail     []byte
}

type CreatePostParams

type CreatePostParams struct {
	Tags    sql.NullString
	Content string
	Private int64
}

type CreateSpotifyCacheParams

type CreateSpotifyCacheParams struct {
	TrackID         string
	TrackName       string
	ArtistName      string
	ArtistID        string
	CoverArtUrl     string
	AudioPreviewUrl string
}

type CreateYoutubebCacheParams

type CreateYoutubebCacheParams struct {
	YtID      string
	Thumb     string
	Title     string
	Author    string
	AuthorUrl string
}

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 GetAllTagsRow

type GetAllTagsRow struct {
	Tag      interface{}
	TagCount int64
}

type GetPostPageParams added in v0.7.0

type GetPostPageParams struct {
	ID int64
	P  int64
}

type Mediafile

type Mediafile struct {
	ID            int64
	FileName      string
	FilePath      string
	FileExtention string
	FileType      string
	Thumbnail     []byte
	UploadedAt    time.Time
}

type Post

type Post struct {
	ID        int64
	CreatedAt int64
	Tags      sql.NullString
	Content   string
	Private   int64
}

type Queries

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

func New

func New(db DBTX) *Queries

func NewQueries

func NewQueries(databaseSource string) *Queries

func (*Queries) Backup

func (q *Queries) Backup(ctx context.Context) (string, error)

func (*Queries) CreateMediafile

func (q *Queries) CreateMediafile(ctx context.Context, arg CreateMediafileParams) (Mediafile, error)

func (*Queries) CreatePost

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

func (*Queries) CreateSpotifyCache

func (q *Queries) CreateSpotifyCache(ctx context.Context, arg CreateSpotifyCacheParams) (SpotifyCache, error)

func (*Queries) CreateYoutubebCache

func (q *Queries) CreateYoutubebCache(ctx context.Context, arg CreateYoutubebCacheParams) (YoutubeCache, error)

func (*Queries) DeleteMediafile

func (q *Queries) DeleteMediafile(ctx context.Context, id int64) error

func (*Queries) DeletePost

func (q *Queries) DeletePost(ctx context.Context, createdAt int64) error

func (*Queries) GetAllTags

func (q *Queries) GetAllTags(ctx context.Context, private int64) ([]GetAllTagsRow, error)

func (*Queries) GetMediaThunbnail

func (q *Queries) GetMediaThunbnail(ctx context.Context, filePath string) ([]byte, error)

func (*Queries) GetMediafile

func (q *Queries) GetMediafile(ctx context.Context, id int64) (Mediafile, error)

func (*Queries) GetPost

func (q *Queries) GetPost(ctx context.Context, createdAt int64) (Post, error)

func (*Queries) GetPostCount

func (q *Queries) GetPostCount(ctx context.Context, private int64) (int64, error)

func (*Queries) GetPostLatest added in v0.7.0

func (q *Queries) GetPostLatest(ctx context.Context) (Post, error)

func (*Queries) GetPostPage

func (q *Queries) GetPostPage(ctx context.Context, arg GetPostPageParams) (int64, error)

func (*Queries) GetSpotifyCache

func (q *Queries) GetSpotifyCache(ctx context.Context, trackID string) (SpotifyCache, error)

func (*Queries) GetYoutubeCache

func (q *Queries) GetYoutubeCache(ctx context.Context, ytID string) (YoutubeCache, error)

func (*Queries) ListMediafiles

func (q *Queries) ListMediafiles(ctx context.Context) ([]Mediafile, error)

func (*Queries) ListPublicPosts added in v0.7.0

func (q *Queries) ListPublicPosts(ctx context.Context) ([]Post, error)

func (*Queries) QueryPost

func (q *Queries) QueryPost(ctx context.Context, tags []string, search string, pritvate int, page int) ([]Post, int, error)

func (*Queries) RemoveUnusedSpotifyCache added in v0.7.1

func (q *Queries) RemoveUnusedSpotifyCache(ctx context.Context) (int64, error)

func (*Queries) RemoveUnusedYoutubeCache added in v0.7.1

func (q *Queries) RemoveUnusedYoutubeCache(ctx context.Context) (int64, error)

func (*Queries) UpdateMedia

func (q *Queries) UpdateMedia(ctx context.Context, arg UpdateMediaParams) error

func (*Queries) UpdatePost

func (q *Queries) UpdatePost(ctx context.Context, arg UpdatePostParams) error

func (*Queries) WithTx

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

type SpotifyCache

type SpotifyCache struct {
	ID              int64
	TrackID         string
	TrackName       string
	ArtistName      string
	ArtistID        string
	CoverArtUrl     string
	AudioPreviewUrl string
}

type UpdateMediaParams

type UpdateMediaParams struct {
	FileName string
	ID       int64
}

type UpdatePostParams

type UpdatePostParams struct {
	Tags      sql.NullString
	Content   string
	Private   int64
	CreatedAt int64
}

type YoutubeCache

type YoutubeCache struct {
	ID        int64
	YtID      string
	Thumb     string
	Title     string
	Author    string
	AuthorUrl string
}

Jump to

Keyboard shortcuts

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