server.Exitfail   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
dl 0
loc 3
c 0
b 0
f 0
rs 10
nop 1
1
//go:generate mockery
2
3
package server
4
5
import (
6
	"context"
7
	"errors"
8
	"fmt"
9
	"os"
10
11
	"github.com/cronnoss/tk-api/internal/storage/models"
12
)
13
14
var (
15
	ErrID     = errors.New("wrong ID")
16
	ErrUserID = errors.New("wrong UserID")
17
	ErrName   = errors.New("wrong Name")
18
)
19
20
type Logger interface {
21
	Fatalf(format string, a ...interface{})
22
	Errorf(format string, a ...interface{})
23
	Warningf(format string, a ...interface{})
24
	Infof(format string, a ...interface{})
25
	Debugf(format string, a ...interface{})
26
}
27
28
type Application interface {
29
	GetShows(ctx context.Context) ([]models.Show, error)
30
	CreateShows(ctx context.Context, shows []models.Show) ([]models.Show, error)
31
	CreateShow(ctx context.Context, shows models.Show) (models.Show, error)
32
	GetEvents(ctx context.Context) ([]models.Event, error)
33
	CreateEvents(ctx context.Context, events []models.Event) ([]models.Event, error)
34
	CreateEvent(ctx context.Context, event models.Event) (models.Event, error)
35
	GetPlaces(ctx context.Context) ([]models.Place, error)
36
	CreatePlaces(ctx context.Context, places []models.Place) ([]models.Place, error)
37
	CreatePlace(ctx context.Context, place models.Place) (models.Place, error)
38
}
39
40
func Exitfail(msg string) {
41
	fmt.Fprintln(os.Stderr, msg)
42
	os.Exit(1)
43
}
44