postgres

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

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package datastore is the implementation of the database session in use by the server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClient

func CreateClient(psqlInfo string) (*sql.DB, error)

CreateClient will create a new database connection with the supplied psqlInfo

func NewNullString

func NewNullString(s string) sql.NullString

NewNullString helps to create a NULL value in sql query if the field is empty

func NewNullTime

func NewNullTime(s string) sql.NullTime

NewNullTime helps to create a NULL value in sql query if the time field is empty

Types

type ArticleStore

type ArticleStore struct {
	DB *sql.DB
}

PostgresRepository encapsulates a db connection with the operations

func (ArticleStore) CreateArticle

func (a ArticleStore) CreateArticle(article *domain.Article) error

CreateArticle will take the data from the stored file and persist it to the database

func (ArticleStore) DeleteArticle

func (a ArticleStore) DeleteArticle(id string) error

func (ArticleStore) GetArticle

func (a ArticleStore) GetArticle(id string) (*domain.Article, error)

func (ArticleStore) ListArticles

func (a ArticleStore) ListArticles() ([]*domain.Article, error)

func (ArticleStore) ListArticlesByParameter

func (a ArticleStore) ListArticlesByParameter(fields ...interface{}) ([]*domain.Article, error)

func (ArticleStore) ModifyArticle

func (a ArticleStore) ModifyArticle(article *domain.Article) error

Jump to

Keyboard shortcuts

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