Created a base to build on
This commit is contained in:
63
internal/api/mock_db_test.go
Normal file
63
internal/api/mock_db_test.go
Normal file
@@ -0,0 +1,63 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"completed/internal/db"
|
||||
)
|
||||
|
||||
type MockQuerier struct {
|
||||
CreateGameFunc func(ctx context.Context, arg db.CreateGameParams) (db.Game, error)
|
||||
CreatePlatformFunc func(ctx context.Context, name string) (db.Platform, error)
|
||||
CreateUserFunc func(ctx context.Context, arg db.CreateUserParams) (db.User, error)
|
||||
DeleteGameFunc func(ctx context.Context, id int64) error
|
||||
DeletePlatformFunc func(ctx context.Context, id int64) error
|
||||
DeleteUserFunc func(ctx context.Context, id int64) error
|
||||
GetGameFunc func(ctx context.Context, id int64) (db.Game, error)
|
||||
GetUserFunc func(ctx context.Context, id int64) (db.User, error)
|
||||
ListGamesFunc func(ctx context.Context) ([]db.Game, error)
|
||||
ListPlatformsFunc func(ctx context.Context) ([]db.Platform, error)
|
||||
ListUsersFunc func(ctx context.Context) ([]db.User, error)
|
||||
UpdateGameFunc func(ctx context.Context, arg db.UpdateGameParams) (db.Game, error)
|
||||
UpdatePlatformFunc func(ctx context.Context, arg db.UpdatePlatformParams) (db.Platform, error)
|
||||
}
|
||||
|
||||
func (m *MockQuerier) CreateGame(ctx context.Context, arg db.CreateGameParams) (db.Game, error) {
|
||||
return m.CreateGameFunc(ctx, arg)
|
||||
}
|
||||
func (m *MockQuerier) CreatePlatform(ctx context.Context, name string) (db.Platform, error) {
|
||||
return m.CreatePlatformFunc(ctx, name)
|
||||
}
|
||||
func (m *MockQuerier) CreateUser(ctx context.Context, arg db.CreateUserParams) (db.User, error) {
|
||||
return m.CreateUserFunc(ctx, arg)
|
||||
}
|
||||
func (m *MockQuerier) DeleteGame(ctx context.Context, id int64) error {
|
||||
return m.DeleteGameFunc(ctx, id)
|
||||
}
|
||||
func (m *MockQuerier) DeletePlatform(ctx context.Context, id int64) error {
|
||||
return m.DeletePlatformFunc(ctx, id)
|
||||
}
|
||||
func (m *MockQuerier) DeleteUser(ctx context.Context, id int64) error {
|
||||
return m.DeleteUserFunc(ctx, id)
|
||||
}
|
||||
func (m *MockQuerier) GetGame(ctx context.Context, id int64) (db.Game, error) {
|
||||
return m.GetGameFunc(ctx, id)
|
||||
}
|
||||
func (m *MockQuerier) GetUser(ctx context.Context, id int64) (db.User, error) {
|
||||
return m.GetUserFunc(ctx, id)
|
||||
}
|
||||
func (m *MockQuerier) ListGames(ctx context.Context) ([]db.Game, error) {
|
||||
return m.ListGamesFunc(ctx)
|
||||
}
|
||||
func (m *MockQuerier) ListPlatforms(ctx context.Context) ([]db.Platform, error) {
|
||||
return m.ListPlatformsFunc(ctx)
|
||||
}
|
||||
func (m *MockQuerier) ListUsers(ctx context.Context) ([]db.User, error) {
|
||||
return m.ListUsersFunc(ctx)
|
||||
}
|
||||
func (m *MockQuerier) UpdateGame(ctx context.Context, arg db.UpdateGameParams) (db.Game, error) {
|
||||
return m.UpdateGameFunc(ctx, arg)
|
||||
}
|
||||
func (m *MockQuerier) UpdatePlatform(ctx context.Context, arg db.UpdatePlatformParams) (db.Platform, error) {
|
||||
return m.UpdatePlatformFunc(ctx, arg)
|
||||
}
|
||||
Reference in New Issue
Block a user