Skip to content

Instantly share code, notes, and snippets.

View bykof's full-sized avatar
:electron:
Let's go to java and have a brainfuck

Michael Bykovski bykof

:electron:
Let's go to java and have a brainfuck
View GitHub Profile
package main
import (
"dashboard/api"
"flamingo.me/dingo"
"flamingo.me/flamingo/v3"
"flamingo.me/flamingo/v3/core/requestlogger"
)
func main() {
package infrastructure
import (
"dashboard/order/domain/entity"
)
type FakeOrderService struct{}
func (fakeOrderService FakeOrderService) GetOrder(id string) (entity.Order, error) {
return entity.Order{
@bykof
bykof / module.go
Last active February 18, 2020 13:15
func (module *Module) Configure(injector *dingo.Injector) {
web.BindRoutes(injector, new(Routes))
if os.Getenv("fake") == "true" {
injector.Bind(new(service.IOrderService)).To(infrastructure.FakeOrderService{})
} else {
injector.Bind(new(service.IOrderService)).To(infrastructure.OrderService{})
}
}
// domain/product.go
package domain
type Product struct {
Name string
Description string
Amount int
)
// domain/product_list.go
package domain
type ProductList []Product
package infrastructure
import (
"encoding/json"
"example.com/dingo_example/domain"
"fmt"
"io/ioutil"
"net/http"
)
package interfaces
import (
"example.com/dingo_example/infrastructure"
"log"
)
type AppController struct {
productAPI infrastructure.ProductAPI
}
package dingo_example
import (
"example.com/dingo_example/infrastructure"
"example.com/dingo_example/interfaces"
)
const ProductApi = "https://my-product-api.com"
func main() {
package dingo_example
import (
"example.com/dingo_example/infrastructure"
"example.com/dingo_example/interfaces"
"flamingo.me/dingo"
)
const ProductApiUrl = "https://my-product-api.com"
package interfaces
import (
"example.com/dingo_example/infrastructure"
"log"
)
type AppController struct {
productAPI infrastructure.ProductAPI
}