Created a base to build on

This commit is contained in:
2025-12-22 21:19:31 +01:00
parent a1e33bd403
commit 47a9719eeb
20 changed files with 1590 additions and 0 deletions

View 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)
}