Initial commit
This commit is contained in:
26
hw12_13_14_15_calendar/internal/app/app.go
Normal file
26
hw12_13_14_15_calendar/internal/app/app.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type App struct { // TODO
|
||||
}
|
||||
|
||||
type Logger interface { // TODO
|
||||
}
|
||||
|
||||
type Storage interface { // TODO
|
||||
}
|
||||
|
||||
func New(logger Logger, storage Storage) *App {
|
||||
return &App{}
|
||||
}
|
||||
|
||||
func (a *App) CreateEvent(ctx context.Context, id, title string) error {
|
||||
// TODO
|
||||
return nil
|
||||
// return a.storage.CreateEvent(storage.Event{ID: id, Title: title})
|
||||
}
|
||||
|
||||
// TODO
|
||||
20
hw12_13_14_15_calendar/internal/logger/logger.go
Normal file
20
hw12_13_14_15_calendar/internal/logger/logger.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package logger
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Logger struct { // TODO
|
||||
}
|
||||
|
||||
func New(level string) *Logger {
|
||||
return &Logger{}
|
||||
}
|
||||
|
||||
func (l Logger) Info(msg string) {
|
||||
fmt.Println(msg)
|
||||
}
|
||||
|
||||
func (l Logger) Error(msg string) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
// TODO
|
||||
7
hw12_13_14_15_calendar/internal/logger/logger_test.go
Normal file
7
hw12_13_14_15_calendar/internal/logger/logger_test.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package logger
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestLogger(t *testing.T) {
|
||||
// TODO
|
||||
}
|
||||
11
hw12_13_14_15_calendar/internal/server/http/middleware.go
Normal file
11
hw12_13_14_15_calendar/internal/server/http/middleware.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package internalhttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func loggingMiddleware(next http.Handler) http.Handler { //nolint:unused
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO
|
||||
})
|
||||
}
|
||||
31
hw12_13_14_15_calendar/internal/server/http/server.go
Normal file
31
hw12_13_14_15_calendar/internal/server/http/server.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package internalhttp
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type Server struct { // TODO
|
||||
}
|
||||
|
||||
type Logger interface { // TODO
|
||||
}
|
||||
|
||||
type Application interface { // TODO
|
||||
}
|
||||
|
||||
func NewServer(logger Logger, app Application) *Server {
|
||||
return &Server{}
|
||||
}
|
||||
|
||||
func (s *Server) Start(ctx context.Context) error {
|
||||
// TODO
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) Stop(ctx context.Context) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO
|
||||
7
hw12_13_14_15_calendar/internal/storage/event.go
Normal file
7
hw12_13_14_15_calendar/internal/storage/event.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package storage
|
||||
|
||||
type Event struct {
|
||||
ID string
|
||||
Title string
|
||||
// TODO
|
||||
}
|
||||
14
hw12_13_14_15_calendar/internal/storage/memory/storage.go
Normal file
14
hw12_13_14_15_calendar/internal/storage/memory/storage.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package memorystorage
|
||||
|
||||
import "sync"
|
||||
|
||||
type Storage struct {
|
||||
// TODO
|
||||
mu sync.RWMutex //nolint:unused
|
||||
}
|
||||
|
||||
func New() *Storage {
|
||||
return &Storage{}
|
||||
}
|
||||
|
||||
// TODO
|
||||
@@ -0,0 +1,7 @@
|
||||
package memorystorage
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestStorage(t *testing.T) {
|
||||
// TODO
|
||||
}
|
||||
20
hw12_13_14_15_calendar/internal/storage/sql/storage.go
Normal file
20
hw12_13_14_15_calendar/internal/storage/sql/storage.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package sqlstorage
|
||||
|
||||
import "context"
|
||||
|
||||
type Storage struct { // TODO
|
||||
}
|
||||
|
||||
func New() *Storage {
|
||||
return &Storage{}
|
||||
}
|
||||
|
||||
func (s *Storage) Connect(ctx context.Context) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Storage) Close(ctx context.Context) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user