Documentation
¶
Index ¶
- Constants
- Variables
- func DBBookMetadataToPBMetadata(row DBBookMetadata) *pbv1.Metadata
- func DBOutputBookToPBBook(row DBOutputBook) *pbv1.Book
- func DBShelfToPBShelf(row DBShelf) *pbv1.Shelf
- type DBBookContent
- type DBBookMetadata
- type DBBookTag
- type DBOutputBook
- type DBShelf
- type DBShelfMember
- type ListMetadataResponse
- type Memory
- func (m *Memory) AddBook(ctx context.Context, req *pbv1.AddBookRequest) error
- func (m *Memory) AddBooksToShelf(ctx context.Context, req *pbv1.AddBooksToShelfRequest) error
- func (m *Memory) CreateShelf(ctx context.Context, shelf *pbv1.Shelf) error
- func (m *Memory) GetAllSeries(ctx context.Context) ([]string, error)
- func (m *Memory) GetBooksBySeries(ctx context.Context, series string) ([]*pbv1.Metadata, error)
- func (m *Memory) ListBooksForShelf(ctx context.Context, req *pbv1.ListBooksForShelfRequest) ([]*pbv1.Metadata, error)
- func (m *Memory) ListMetadata(ctx context.Context, req *pbv1.ListBooksRequest) (*ListMetadataResponse, error)
- func (m *Memory) ListShelves(ctx context.Context) ([]*pbv1.Shelf, error)
- func (m *Memory) Purge(ctx context.Context) error
- func (m *Memory) ReadBook(ctx context.Context, id string) (*pbv1.Book, error)
- func (m *Memory) RemoveBook(ctx context.Context, req *pbv1.RemoveBookRequest) error
- func (m *Memory) RemoveBooksFromShelf(ctx context.Context, req *pbv1.RemoveBooksFromShelfRequest) error
- type MemoryConfig
- type Postgres
- func (p *Postgres) AddBook(ctx context.Context, req *pbv1.AddBookRequest) error
- func (p *Postgres) AddBooksToShelf(ctx context.Context, req *pbv1.AddBooksToShelfRequest) error
- func (p *Postgres) CreateShelf(ctx context.Context, shelf *pbv1.Shelf) error
- func (p *Postgres) GetAllSeries(ctx context.Context) ([]string, error)
- func (p *Postgres) GetBooksBySeries(ctx context.Context, series string) ([]*pbv1.Metadata, error)
- func (p *Postgres) ListBooksForShelf(ctx context.Context, req *pbv1.ListBooksForShelfRequest) ([]*pbv1.Metadata, error)
- func (p *Postgres) ListMetadata(ctx context.Context, req *pbv1.ListBooksRequest) (*ListMetadataResponse, error)
- func (p *Postgres) ListShelves(ctx context.Context) ([]*pbv1.Shelf, error)
- func (p *Postgres) Purge(ctx context.Context) error
- func (p *Postgres) ReadBook(ctx context.Context, id string) (*pbv1.Book, error)
- func (p *Postgres) RemoveBook(ctx context.Context, req *pbv1.RemoveBookRequest) error
- func (p *Postgres) RemoveBooksFromShelf(ctx context.Context, req *pbv1.RemoveBooksFromShelfRequest) error
- type PostgresConfig
- type Storer
Constants ¶
View Source
const ( PGError_ForeignKeyViolation = "23503" PGError_CheckConstraintViolation = "23514" )
Taken from https://www.postgresql.org/docs/current/errcodes-appendix.html
Variables ¶
Functions ¶
func DBBookMetadataToPBMetadata ¶ added in v0.1.0
func DBBookMetadataToPBMetadata(row DBBookMetadata) *pbv1.Metadata
func DBOutputBookToPBBook ¶ added in v0.1.0
func DBOutputBookToPBBook(row DBOutputBook) *pbv1.Book
func DBShelfToPBShelf ¶ added in v0.1.0
Types ¶
type DBBookContent ¶ added in v0.1.0
type DBBookMetadata ¶ added in v0.1.0
type DBBookMetadata struct {
ID string `db:"id"`
Title string `db:"title"`
Author sql.Null[string] `db:"author"`
Series sql.Null[string] `db:"series"`
SeriesNumber sql.Null[float32] `db:"series_number"`
UploadTS time.Time `db:"upload_ts"`
}
func PBMetadataToDBBookMetadata ¶ added in v0.1.0
func PBMetadataToDBBookMetadata(metadata *pbv1.Metadata) DBBookMetadata
type DBOutputBook ¶ added in v0.1.0
type DBOutputBook struct {
DBBookMetadata
Content []byte `db:"content"`
}
type DBShelf ¶ added in v0.1.0
func PBShelfToDBShelf ¶ added in v0.1.0
type DBShelfMember ¶ added in v0.1.0
func PBAddShelfBooksRequestToDBShelfMembers ¶ added in v0.1.0
func PBAddShelfBooksRequestToDBShelfMembers(req *pbv1.AddBooksToShelfRequest) []DBShelfMember
type ListMetadataResponse ¶ added in v0.5.0
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func NewMemory ¶
func NewMemory(conf MemoryConfig) *Memory
func (*Memory) AddBooksToShelf ¶
func (*Memory) CreateShelf ¶
func (*Memory) GetBooksBySeries ¶
func (*Memory) ListBooksForShelf ¶
func (*Memory) ListMetadata ¶
func (m *Memory) ListMetadata(ctx context.Context, req *pbv1.ListBooksRequest) (*ListMetadataResponse, error)
func (*Memory) ListShelves ¶
func (*Memory) RemoveBook ¶
func (*Memory) RemoveBooksFromShelf ¶
type MemoryConfig ¶
type MemoryConfig struct{}
type Postgres ¶ added in v0.1.0
type Postgres struct {
// contains filtered or unexported fields
}
func NewPostgres ¶ added in v0.1.0
func NewPostgres(conf PostgresConfig) *Postgres
func (*Postgres) AddBooksToShelf ¶ added in v0.1.0
func (*Postgres) CreateShelf ¶ added in v0.1.0
func (*Postgres) GetAllSeries ¶ added in v0.1.0
func (*Postgres) GetBooksBySeries ¶ added in v0.1.0
func (*Postgres) ListBooksForShelf ¶ added in v0.1.0
func (*Postgres) ListMetadata ¶ added in v0.1.0
func (p *Postgres) ListMetadata(ctx context.Context, req *pbv1.ListBooksRequest) (*ListMetadataResponse, error)
func (*Postgres) ListShelves ¶ added in v0.1.0
func (*Postgres) RemoveBook ¶ added in v0.1.0
func (*Postgres) RemoveBooksFromShelf ¶ added in v0.1.0
type PostgresConfig ¶ added in v0.1.0
type Storer ¶
type Storer interface {
Purge(ctx context.Context) error
AddBook(ctx context.Context, req *pbv1.AddBookRequest) error
ReadBook(ctx context.Context, id string) (*pbv1.Book, error)
RemoveBook(ctx context.Context, req *pbv1.RemoveBookRequest) error
ListMetadata(ctx context.Context, req *pbv1.ListBooksRequest) (*ListMetadataResponse, error)
GetAllSeries(ctx context.Context) ([]string, error)
GetBooksBySeries(ctx context.Context, series string) ([]*pbv1.Metadata, error)
CreateShelf(ctx context.Context, shelf *pbv1.Shelf) error
ListShelves(ctx context.Context) ([]*pbv1.Shelf, error)
AddBooksToShelf(ctx context.Context, req *pbv1.AddBooksToShelfRequest) error
RemoveBooksFromShelf(ctx context.Context, req *pbv1.RemoveBooksFromShelfRequest) error
ListBooksForShelf(ctx context.Context, req *pbv1.ListBooksForShelfRequest) ([]*pbv1.Metadata, error)
}
Click to show internal directories.
Click to hide internal directories.