postgresdb_repo

package
v0.9.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BookTableName is table name for books entity
	BookTableName = "books"
	// BookTable is columns for books entity
	BookTable = struct {
		ID        string
		Title     string
		Author    string
		UpdatedAt string
		CreatedAt string
	}{
		ID:        "id",
		Title:     "title",
		Author:    "author",
		UpdatedAt: "updated_at",
		CreatedAt: "created_at",
	}
)

Functions

This section is empty.

Types

type BookRepo

BookRepo to get books data from database @mock

func NewBookRepo

func NewBookRepo(impl BookRepoImpl) BookRepo

NewBookRepo return new instance of BookRepo

type BookRepoImpl

type BookRepoImpl struct {
	dig.In
	*sql.DB `name:"pg"`
}

BookRepoImpl is implementation books repository

func (*BookRepoImpl) Create

func (r *BookRepoImpl) Create(ctx context.Context, ent *postgresdb.Book) (int64, error)

Create books

func (*BookRepoImpl) Delete

func (r *BookRepoImpl) Delete(ctx context.Context, opt dbkit.DeleteOption) (int64, error)

Delete books

func (*BookRepoImpl) Find

func (r *BookRepoImpl) Find(ctx context.Context, opts ...dbkit.SelectOption) (list []*postgresdb.Book, err error)

Find books

func (*BookRepoImpl) Patch

func (r *BookRepoImpl) Patch(ctx context.Context, ent *postgresdb.Book, opt dbkit.UpdateOption) (int64, error)

Patch books

func (*BookRepoImpl) Update

func (r *BookRepoImpl) Update(ctx context.Context, ent *postgresdb.Book, opt dbkit.UpdateOption) (int64, error)

Update books

Jump to

Keyboard shortcuts

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