db

package
v0.0.0-...-2610577 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB allows to acccess articles db.

func New

func New(sqldb *sql.DB) *DB

New returns an articles db.

func (*DB) Create

func (db *DB) Create(ctx context.Context, article *articles.Article) error

Create adds a new articles to the database.

func (*DB) Delete

func (db *DB) Delete(ctx context.Context, id string, userID string) error

Delete deletes an article by id.

func (*DB) Get

func (db *DB) Get(ctx context.Context, id string, userID string) (*articles.Article, error)

Get returns article by id.

func (*DB) GetByUserIDUrl

func (db *DB) GetByUserIDUrl(ctx context.Context, userID string, url string) (*articles.Article, error)

GetByUserIDUrl returns article by userId and sha256 sum.

func (*DB) List

func (db *DB) List(ctx context.Context, request *articles.ListArticlesRequest) ([]*articles.Article, error)

List returns all articles.

func (*DB) Update

func (db *DB) Update(ctx context.Context, article *articles.Article, userID string) error

Update updates an article.

Jump to

Keyboard shortcuts

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