init
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package storage
|
||||
|
||||
import "context"
|
||||
|
||||
type Product struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
// todo
|
||||
}
|
||||
|
||||
type Breadcrumb struct {
|
||||
Name string `json:"name"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
type IStorage interface {
|
||||
GetAllProducts(ctx context.Context) ([]Product, error)
|
||||
GetProductByID(ctx context.Context, id int) (Product, error)
|
||||
GetBreadcrumbs(ctx context.Context, id int) ([]Breadcrumb, error)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package storage_file
|
||||
|
||||
import (
|
||||
"cake_crm/internal/models/storage"
|
||||
"context"
|
||||
)
|
||||
|
||||
type storageFile struct {
|
||||
filepath string
|
||||
}
|
||||
|
||||
func NewStorageFile(filepath string) storage.IStorage {
|
||||
return &storageFile{
|
||||
filepath: filepath,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *storageFile) GetAllProducts(ctx context.Context) ([]storage.Product, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *storageFile) GetProductByID(ctx context.Context, id int) (storage.Product, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *storageFile) GetBreadcrumbs(ctx context.Context, id int) ([]storage.Breadcrumb, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
Reference in New Issue
Block a user