repo

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 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",
	}
)
View Source
var (
	// SongTableName is table name for songs entity
	SongTableName = "songs"
	// SongTable is columns for songs entity
	SongTable = struct {
		ID        string
		Title     string
		Artist    string
		UpdatedAt string
		CreatedAt string
	}{
		ID:        "id",
		Title:     "title",
		Artist:    "artist",
		UpdatedAt: "updated_at",
		CreatedAt: "created_at",
	}
)

Functions

This section is empty.

Types

type BookRepo

BookRepo to get books data from database

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) Count

func (r *BookRepoImpl) Count(ctx context.Context, opts ...sqkit.SelectOption) (int64, error)

Count books

func (*BookRepoImpl) Create

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

Create books

func (*BookRepoImpl) Delete

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

Delete books

func (*BookRepoImpl) Find

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

Find books

func (*BookRepoImpl) Patch

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

Patch books

func (*BookRepoImpl) Update

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

Update books

type SongRepo

SongRepo to get songs data from database

func NewSongRepo

func NewSongRepo(impl SongRepoImpl) SongRepo

NewSongRepo return new instance of SongRepo

type SongRepoImpl

type SongRepoImpl struct {
	dig.In
	*sql.DB `name:"mysql"`
}

SongRepoImpl is implementation songs repository

func (*SongRepoImpl) Count

func (r *SongRepoImpl) Count(ctx context.Context, opts ...sqkit.SelectOption) (int64, error)

Count songs

func (*SongRepoImpl) Create

func (r *SongRepoImpl) Create(ctx context.Context, ent *entity.Song) (int64, error)

Create songs

func (*SongRepoImpl) Delete

func (r *SongRepoImpl) Delete(ctx context.Context, opt sqkit.DeleteOption) (int64, error)

Delete songs

func (*SongRepoImpl) Find

func (r *SongRepoImpl) Find(ctx context.Context, opts ...sqkit.SelectOption) (list []*entity.Song, err error)

Find songs

func (*SongRepoImpl) Patch

func (r *SongRepoImpl) Patch(ctx context.Context, ent *entity.Song, opt sqkit.UpdateOption) (int64, error)

Patch songs

func (*SongRepoImpl) Update

func (r *SongRepoImpl) Update(ctx context.Context, ent *entity.Song, opt sqkit.UpdateOption) (int64, error)

Update songs

Jump to

Keyboard shortcuts

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