internal/server/server.go   A
last analyzed

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 29
dl 0
loc 40
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A server.Exitfail 0 3 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