repository

package
v0.8.13 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	ID        int64     `json:"id"`
	Title     string    `json:"title" validate:"required"`
	Author    string    `json:"author" validate:"required"`
	UpdatedAt time.Time `json:"-"`
	CreatedAt time.Time `json:"-"`
}

Book represented database model

type BookRepo added in v0.8.0

type BookRepo interface {
	Find(ctx context.Context, id int64) (*Book, error)
	List(ctx context.Context) ([]*Book, error)
	Insert(ctx context.Context, book Book) (lastInsertID int64, err error)
	Delete(ctx context.Context, id int64) error
	Update(ctx context.Context, book Book) error
}

BookRepo to get book data from databasesa

func NewBookRepo added in v0.8.0

func NewBookRepo(impl CachedBookRepoImpl) BookRepo

NewBookRepo return new instance of BookRepo

type BookRepoImpl added in v0.8.0

type BookRepoImpl struct {
	dig.In
	*sql.DB
}

BookRepoImpl is implementation book repository

func (*BookRepoImpl) Delete added in v0.8.0

func (r *BookRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete book

func (*BookRepoImpl) Find added in v0.8.0

func (r *BookRepoImpl) Find(ctx context.Context, id int64) (book *Book, err error)

Find book

func (*BookRepoImpl) Insert added in v0.8.0

func (r *BookRepoImpl) Insert(ctx context.Context, book Book) (lastInsertID int64, err error)

Insert book

func (*BookRepoImpl) List added in v0.8.0

func (r *BookRepoImpl) List(ctx context.Context) (list []*Book, err error)

List book

func (*BookRepoImpl) Update added in v0.8.0

func (r *BookRepoImpl) Update(ctx context.Context, book Book) (err error)

Update book

type CachedBookRepoImpl added in v0.8.0

type CachedBookRepoImpl struct {
	dig.In
	BookRepoImpl
	Redis *redis.Client
}

CachedBookRepoImpl is cached implementation of book repository

func (*CachedBookRepoImpl) Find added in v0.8.0

func (r *CachedBookRepoImpl) Find(ctx context.Context, id int64) (book *Book, err error)

Find book entity

func (*CachedBookRepoImpl) List added in v0.8.0

func (r *CachedBookRepoImpl) List(ctx context.Context) (list []*Book, err error)

List of book entity

type CachedDataSourceRepoImpl added in v0.8.13

type CachedDataSourceRepoImpl struct {
	dig.In
	DataSourceRepoImpl
	Redis *redis.Client
}

CachedDataSourceRepoImpl is cached implementation of data_source repository

func (*CachedDataSourceRepoImpl) Find added in v0.8.13

func (r *CachedDataSourceRepoImpl) Find(ctx context.Context, id int64) (e *DataSource, err error)

Find data_source entity

func (*CachedDataSourceRepoImpl) List added in v0.8.13

func (r *CachedDataSourceRepoImpl) List(ctx context.Context) (list []*DataSource, err error)

List of data_source entity

type CachedLocaleRepoImpl added in v0.8.13

type CachedLocaleRepoImpl struct {
	dig.In
	LocaleRepoImpl
	Redis *redis.Client
}

CachedLocaleRepoImpl is cached implementation of locale repository

func (*CachedLocaleRepoImpl) Find added in v0.8.13

func (r *CachedLocaleRepoImpl) Find(ctx context.Context, id int64) (e *Locale, err error)

Find locale entity

func (*CachedLocaleRepoImpl) List added in v0.8.13

func (r *CachedLocaleRepoImpl) List(ctx context.Context) (list []*Locale, err error)

List of locale entity

type CachedMusicRepoImpl added in v0.8.11

type CachedMusicRepoImpl struct {
	dig.In
	MusicRepoImpl
	Redis *redis.Client
}

CachedMusicRepoImpl is cached implementation of music repository

func (*CachedMusicRepoImpl) Find added in v0.8.11

func (r *CachedMusicRepoImpl) Find(ctx context.Context, id int64) (e *Music, err error)

Find music entity

func (*CachedMusicRepoImpl) List added in v0.8.11

func (r *CachedMusicRepoImpl) List(ctx context.Context) (list []*Music, err error)

List of music entity

type CachedTagRepoImpl added in v0.8.13

type CachedTagRepoImpl struct {
	dig.In
	TagRepoImpl
	Redis *redis.Client
}

CachedTagRepoImpl is cached implementation of tag repository

func (*CachedTagRepoImpl) Find added in v0.8.13

func (r *CachedTagRepoImpl) Find(ctx context.Context, id int64) (e *Tag, err error)

Find tag entity

func (*CachedTagRepoImpl) List added in v0.8.13

func (r *CachedTagRepoImpl) List(ctx context.Context) (list []*Tag, err error)

List of tag entity

type DataSource added in v0.8.13

type DataSource struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Url       string    `json:"url"`
	UpdatedAt time.Time `json:"updated_at"`
	CreatedAt time.Time `json:"created_at"`
}

DataSource represented data_source entity

type DataSourceRepo added in v0.8.13

type DataSourceRepo interface {
	Find(context.Context, int64) (*DataSource, error)
	List(context.Context) ([]*DataSource, error)
	Insert(context.Context, DataSource) (lastInsertID int64, err error)
	Delete(context.Context, int64) error
	Update(context.Context, DataSource) error
}

DataSourceRepo to handle data_sources entity

func NewDataSourceRepo added in v0.8.13

func NewDataSourceRepo(impl CachedDataSourceRepoImpl) DataSourceRepo

NewDataSourceRepo return new instance of DataSourceRepo

type DataSourceRepoImpl added in v0.8.13

type DataSourceRepoImpl struct {
	dig.In
	*sql.DB
}

DataSourceRepoImpl is implementation data_source repository

func (*DataSourceRepoImpl) Delete added in v0.8.13

func (r *DataSourceRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete data_source

func (*DataSourceRepoImpl) Find added in v0.8.13

func (r *DataSourceRepoImpl) Find(ctx context.Context, id int64) (e *DataSource, err error)

Find data_source

func (*DataSourceRepoImpl) Insert added in v0.8.13

func (r *DataSourceRepoImpl) Insert(ctx context.Context, e DataSource) (lastInsertID int64, err error)

Insert data_source

func (*DataSourceRepoImpl) List added in v0.8.13

func (r *DataSourceRepoImpl) List(ctx context.Context) (list []*DataSource, err error)

List data_source

func (*DataSourceRepoImpl) Update added in v0.8.13

func (r *DataSourceRepoImpl) Update(ctx context.Context, e DataSource) (err error)

Update data_source

type Locale added in v0.8.13

type Locale struct {
	ID          int64     `json:"id"`
	LangCode    string    `json:"lang_code"`
	CountryCode string    `json:"country_code"`
	UpdatedAt   time.Time `json:"updated_at"`
	CreatedAt   time.Time `json:"created_at"`
}

Locale represented locale entity

type LocaleRepo added in v0.8.13

type LocaleRepo interface {
	Find(context.Context, int64) (*Locale, error)
	List(context.Context) ([]*Locale, error)
	Insert(context.Context, Locale) (lastInsertID int64, err error)
	Delete(context.Context, int64) error
	Update(context.Context, Locale) error
}

LocaleRepo to handle locales entity

func NewLocaleRepo added in v0.8.13

func NewLocaleRepo(impl CachedLocaleRepoImpl) LocaleRepo

NewLocaleRepo return new instance of LocaleRepo

type LocaleRepoImpl added in v0.8.13

type LocaleRepoImpl struct {
	dig.In
	*sql.DB
}

LocaleRepoImpl is implementation locale repository

func (*LocaleRepoImpl) Delete added in v0.8.13

func (r *LocaleRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete locale

func (*LocaleRepoImpl) Find added in v0.8.13

func (r *LocaleRepoImpl) Find(ctx context.Context, id int64) (e *Locale, err error)

Find locale

func (*LocaleRepoImpl) Insert added in v0.8.13

func (r *LocaleRepoImpl) Insert(ctx context.Context, e Locale) (lastInsertID int64, err error)

Insert locale

func (*LocaleRepoImpl) List added in v0.8.13

func (r *LocaleRepoImpl) List(ctx context.Context) (list []*Locale, err error)

List locale

func (*LocaleRepoImpl) Update added in v0.8.13

func (r *LocaleRepoImpl) Update(ctx context.Context, e Locale) (err error)

Update locale

type Music added in v0.8.11

type Music struct {
	ID        int64     `json:"id"`
	Artist    string    `json:"artist"`
	UpdatedAt time.Time `json:"updated_at"`
	CreatedAt time.Time `json:"created_at"`
}

Music represented music entity

type MusicRepo added in v0.8.11

type MusicRepo interface {
	Find(context.Context, int64) (*Music, error)
	List(context.Context) ([]*Music, error)
	Insert(context.Context, Music) (lastInsertID int64, err error)
	Delete(context.Context, int64) error
	Update(context.Context, Music) error
}

MusicRepo to handle musics entity

func NewMusicRepo added in v0.8.11

func NewMusicRepo(impl CachedMusicRepoImpl) MusicRepo

NewMusicRepo return new instance of MusicRepo

type MusicRepoImpl added in v0.8.11

type MusicRepoImpl struct {
	dig.In
	*sql.DB
}

MusicRepoImpl is implementation music repository

func (*MusicRepoImpl) Delete added in v0.8.11

func (r *MusicRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete music

func (*MusicRepoImpl) Find added in v0.8.11

func (r *MusicRepoImpl) Find(ctx context.Context, id int64) (e *Music, err error)

Find music

func (*MusicRepoImpl) Insert added in v0.8.11

func (r *MusicRepoImpl) Insert(ctx context.Context, e Music) (lastInsertID int64, err error)

Insert music

func (*MusicRepoImpl) List added in v0.8.11

func (r *MusicRepoImpl) List(ctx context.Context) (list []*Music, err error)

List music

func (*MusicRepoImpl) Update added in v0.8.11

func (r *MusicRepoImpl) Update(ctx context.Context, e Music) (err error)

Update music

type Tag added in v0.8.13

type Tag struct {
	ID         int64      `json:"id"`
	Type       string     `json:"type"`
	Attributes dbkit.JSON `json:"attributes"`
	Value      string     `json:"value"`
	UpdatedAt  time.Time  `json:"updated_at"`
	CreatedAt  time.Time  `json:"created_at"`
}

Tag represented tag entity

type TagRepo added in v0.8.13

type TagRepo interface {
	Find(context.Context, int64) (*Tag, error)
	List(context.Context) ([]*Tag, error)
	Insert(context.Context, Tag) (lastInsertID int64, err error)
	Delete(context.Context, int64) error
	Update(context.Context, Tag) error
}

TagRepo to handle tags entity

func NewTagRepo added in v0.8.13

func NewTagRepo(impl CachedTagRepoImpl) TagRepo

NewTagRepo return new instance of TagRepo

type TagRepoImpl added in v0.8.13

type TagRepoImpl struct {
	dig.In
	*sql.DB
}

TagRepoImpl is implementation tag repository

func (*TagRepoImpl) Delete added in v0.8.13

func (r *TagRepoImpl) Delete(ctx context.Context, id int64) (err error)

Delete tag

func (*TagRepoImpl) Find added in v0.8.13

func (r *TagRepoImpl) Find(ctx context.Context, id int64) (e *Tag, err error)

Find tag

func (*TagRepoImpl) Insert added in v0.8.13

func (r *TagRepoImpl) Insert(ctx context.Context, e Tag) (lastInsertID int64, err error)

Insert tag

func (*TagRepoImpl) List added in v0.8.13

func (r *TagRepoImpl) List(ctx context.Context) (list []*Tag, err error)

List tag

func (*TagRepoImpl) Update added in v0.8.13

func (r *TagRepoImpl) Update(ctx context.Context, e Tag) (err error)

Update tag

type Transactional added in v0.8.12

type Transactional struct {
	dig.In
	*sql.DB
}

Transactional database

func (*Transactional) CancelMe added in v0.8.13

func (t *Transactional) CancelMe(ctx context.Context, err error) error

CancelMe is store error to context to trigger the rollback mechanism

func (*Transactional) CommitMe added in v0.8.12

func (t *Transactional) CommitMe(ctx *context.Context) func() error

CommitMe to create begin transaction and return commit function to be deffered

Jump to

Keyboard shortcuts

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