Documentation ¶
Index ¶
- Variables
- type Song
- type SongRepo
- type SongRepoImpl
- func (r *SongRepoImpl) Create(ctx context.Context, song *Song) (int64, error)
- func (r *SongRepoImpl) Delete(ctx context.Context, opt dbkit.DeleteOption) (int64, error)
- func (r *SongRepoImpl) Find(ctx context.Context, opts ...dbkit.SelectOption) (list []*Song, err error)
- func (r *SongRepoImpl) Patch(ctx context.Context, song *Song, opt dbkit.UpdateOption) (int64, error)
- func (r *SongRepoImpl) Update(ctx context.Context, song *Song, opt dbkit.UpdateOption) (int64, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SongTableName is table name for song entity SongTableName = "songs" // SongTable is columns for song 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 Song ¶
type Song struct { ID int64 `json:"id"` Title string `json:"title" validate:"required"` Artist string `json:"artist" validate:"required"` UpdatedAt time.Time `json:"update_at"` CreatedAt time.Time `json:"created_at"` }
Song entity
type SongRepo ¶
type SongRepo interface { Find(context.Context, ...dbkit.SelectOption) ([]*Song, error) Create(context.Context, *Song) (int64, error) Delete(context.Context, dbkit.DeleteOption) (int64, error) Update(context.Context, *Song, dbkit.UpdateOption) (int64, error) Patch(context.Context, *Song, dbkit.UpdateOption) (int64, error) }
SongRepo to get song data from database @mock
func NewSongRepo ¶
func NewSongRepo(impl SongRepoImpl) SongRepo
NewSongRepo return new instance of SongRepo @ctor
type SongRepoImpl ¶
SongRepoImpl is implementation song repository
func (*SongRepoImpl) Delete ¶
func (r *SongRepoImpl) Delete(ctx context.Context, opt dbkit.DeleteOption) (int64, error)
Delete song
func (*SongRepoImpl) Find ¶
func (r *SongRepoImpl) Find(ctx context.Context, opts ...dbkit.SelectOption) (list []*Song, err error)
Find song
func (*SongRepoImpl) Patch ¶
func (r *SongRepoImpl) Patch(ctx context.Context, song *Song, opt dbkit.UpdateOption) (int64, error)
Patch song to update field of song if available
func (*SongRepoImpl) Update ¶
func (r *SongRepoImpl) Update(ctx context.Context, song *Song, opt dbkit.UpdateOption) (int64, error)
Update song
Click to show internal directories.
Click to hide internal directories.