Commit 432e4424 authored by Yannick Buron's avatar Yannick Buron

pipedrive

Signed-off-by: Yannick Buron's avatarYannick Buron <[email protected]>
parent ab0710ed
Pipeline #130072332 failed with stages
in 9 minutes and 32 seconds
......@@ -15,7 +15,7 @@ import (
config "github.com/uber/jaeger-client-go/config"
"gitlab.com/empowerlab/stack/lib-go/libdata"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/memory"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
// "gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
"gitlab.com/empowerlab/stack/lib-go/libgrpc"
"gitlab.com/empowerlab/stack/lib-go/liborm"
......@@ -45,25 +45,24 @@ func init() {
fmt.Println(nats.DefaultURL)
fmt.Println(os.Getenv("NATS_HOST"))
libdata.NatsClient, err = nats.Connect(os.Getenv("NATS_HOST"))
libdata.NatsClientToRemoveInFavorOfDriver, err = nats.Connect(os.Getenv("NATS_HOST"))
if err != nil {
fmt.Printf("Impossible to connect to NATS: %v\n", err)
}
fmt.Println(os.Getenv("DATABASE_URL"))
postgresDriver := &postgres.Driver{}
postgresInfo := libdata.ClusterInfo{
Driver: postgresDriver,
URL: os.Getenv("DATABASE_URL"),
}
liborm.Cluster, err = libdata.InitDB(false, &postgresInfo, &postgresInfo, nil)
if err != nil {
log.Fatalf("Error initializing db %s", err.Error())
}
// fmt.Println(os.Getenv("DATABASE_URL"))
// postgresDriver := &postgres.Driver{}
// postgresInfo := libdata.ClusterInfo{
// Driver: postgresDriver,
// URL: os.Getenv("DATABASE_URL"),
// }
// liborm.Cluster, err = libdata.InitDB(false, &postgresInfo, &postgresInfo, nil)
// if err != nil {
// log.Fatalf("Error initializing db %s", err.Error())
// }
liborm.Cluster.CacheDriver = &memory.Driver{}
liborm.Cluster.Register(genmodels.CustomerDefinition.Model)
liborm.Cluster.Register(genmodels.EventDefinition.Model)
libdata.EventDriver = postgresDriver
log.Println("Schema loaded...")
......
package orm
import (
"fmt"
"log"
"os"
"gitlab.com/empowerlab/stack/lib-go/libdata"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
"gitlab.com/empowerlab/stack/lib-go/libdata/fields"
"gitlab.com/empowerlab/stack/lib-go/libdata/specials"
"gitlab.com/empowerlab/stack/lib-go/liborm"
......@@ -11,13 +16,26 @@ var Definitions *liborm.Definitions
func init() {
fmt.Println(os.Getenv("DATABASE_URL"))
postgresDriver := &postgres.Driver{}
postgresInfo := &libdata.ClusterInfo{
Driver: postgresDriver,
URL: os.Getenv("DATABASE_URL"),
}
var err error
liborm.Cluster, err = libdata.InitDB(false, postgresInfo, postgresInfo, nil)
if err != nil {
log.Fatalf("Error initializing db %s", err.Error())
}
Definitions = &liborm.Definitions{
Repository: "gitlab.com/empowerlab/example/service-customer",
}
Definitions.Register(&liborm.Definition{
Model: &libdata.ModelDefinition{
Name: "customer",
Cluster: liborm.Cluster,
Name: "customer",
Fields: []libdata.Field{
&fields.Text{Name: "name", Required: true},
&fields.Text{Name: "street"},
......@@ -30,6 +48,8 @@ func init() {
},
})
specials.EventModel.Cluster = liborm.Cluster
libdata.EventDriver = postgresDriver
Definitions.Register(&liborm.Definition{
Model: specials.EventModel,
})
......
......@@ -15,7 +15,7 @@ import (
// config "github.com/uber/jaeger-client-go/config"
"gitlab.com/empowerlab/stack/lib-go/libdata"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/memory"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
// "gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
"gitlab.com/empowerlab/stack/lib-go/libgrpc"
"gitlab.com/empowerlab/stack/lib-go/liborm"
......@@ -48,21 +48,21 @@ func init() {
fmt.Println(nats.DefaultURL)
fmt.Println(os.Getenv("NATS_HOST"))
libdata.NatsClient, err = nats.Connect(os.Getenv("NATS_HOST"))
libdata.NatsClientToRemoveInFavorOfDriver, err = nats.Connect(os.Getenv("NATS_HOST"))
if err != nil {
fmt.Printf("Impossible to connect to NATS: %v\n", err)
}
fmt.Println(os.Getenv("DATABASE_URL"))
postgresDriver := &postgres.Driver{}
postgresInfo := libdata.ClusterInfo{
Driver: postgresDriver,
URL: os.Getenv("DATABASE_URL"),
}
liborm.Cluster, err = libdata.InitDB(false, &postgresInfo, &postgresInfo, nil)
if err != nil {
log.Fatalf("Error initializing db %s", err.Error())
}
// fmt.Println(os.Getenv("DATABASE_URL"))
// postgresDriver := &postgres.Driver{}
// postgresInfo := libdata.ClusterInfo{
// Driver: postgresDriver,
// URL: os.Getenv("DATABASE_URL"),
// }
// liborm.Cluster, err = libdata.InitDB(false, &postgresInfo, &postgresInfo, nil)
// if err != nil {
// log.Fatalf("Error initializing db %s", err.Error())
// }
liborm.Cluster.CacheDriver = &memory.Driver{}
liborm.Cluster.Register(genorm.CustomerDefinition.Model)
......@@ -70,7 +70,7 @@ func init() {
liborm.Cluster.Register(genorm.InvoiceDefinition.Model)
liborm.Cluster.Register(genorm.InvoiceLineDefinition.Model)
liborm.Cluster.Register(genorm.EventDefinition.Model)
libdata.EventDriver = postgresDriver
// libdata.EventDriver = postgresDriver
// libdata.CacheDriver = &memory.Driver{}
......
......@@ -3,11 +3,13 @@ package orm
import (
"fmt"
"io"
"log"
"os"
"github.com/joho/godotenv"
"gitlab.com/empowerlab/stack/lib-go/libdata"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/grpc"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
"gitlab.com/empowerlab/stack/lib-go/libdata/fields"
"gitlab.com/empowerlab/stack/lib-go/libdata/specials"
// "gitlab.com/empowerlab/stack/lib-go/libgrpc"
......@@ -62,6 +64,17 @@ func init() {
}
fmt.Printf("productClient %+v\n", ProductClient)
fmt.Println(os.Getenv("DATABASE_URL"))
postgresDriver := &postgres.Driver{}
postgresInfo := &libdata.ClusterInfo{
Driver: postgresDriver,
URL: os.Getenv("DATABASE_URL"),
}
liborm.Cluster, err = libdata.InitDB(false, postgresInfo, postgresInfo, nil)
if err != nil {
log.Fatalf("Error initializing db %s", err.Error())
}
Definitions = &liborm.Definitions{
Repository: "gitlab.com/empowerlab/example/service-invoicing",
}
......@@ -80,7 +93,8 @@ func init() {
Definitions.Register(&liborm.Definition{
Model: &libdata.ModelDefinition{
Name: "customer",
Cluster: liborm.Cluster,
Name: "customer",
Fields: []libdata.Field{
&fields.Text{Name: "name", Required: true},
&fields.Text{Name: "street"},
......@@ -97,7 +111,8 @@ func init() {
Definitions.Register(&liborm.Definition{
Model: &libdata.ModelDefinition{
Name: "product",
Cluster: liborm.Cluster,
Name: "product",
Fields: []libdata.Field{
&fields.Text{Name: "name", Required: true, Store: false},
&fields.Float{Name: "price", Required: true},
......@@ -110,7 +125,8 @@ func init() {
Definitions.Register(&liborm.Definition{
Model: &libdata.ModelDefinition{
Name: "invoice",
Cluster: liborm.Cluster,
Name: "invoice",
Fields: []libdata.Field{
&fields.Text{Name: "number", Required: true},
&fields.Many2one{Name: "customerUUID", Reference: "customer", Required: true},
......@@ -124,7 +140,8 @@ func init() {
Definitions.Register(&liborm.Definition{
Model: &libdata.ModelDefinition{
Name: "invoiceLine",
Cluster: liborm.Cluster,
Name: "invoiceLine",
Fields: []libdata.Field{
&fields.Many2one{Name: "invoiceUUID", Reference: "invoice", Required: true},
&fields.Many2one{Name: "productUUID", Reference: "product", Required: true},
......@@ -137,6 +154,8 @@ func init() {
},
})
specials.EventModel.Cluster = liborm.Cluster
libdata.EventDriver = postgresDriver
Definitions.Register(&liborm.Definition{
Model: specials.EventModel,
})
......
......@@ -15,7 +15,7 @@ import (
config "github.com/uber/jaeger-client-go/config"
"gitlab.com/empowerlab/stack/lib-go/libdata"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/memory"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
// "gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
"gitlab.com/empowerlab/stack/lib-go/libgrpc"
"gitlab.com/empowerlab/stack/lib-go/liborm"
......@@ -45,25 +45,25 @@ func init() {
fmt.Println(nats.DefaultURL)
fmt.Println(os.Getenv("NATS_HOST"))
libdata.NatsClient, err = nats.Connect(os.Getenv("NATS_HOST"))
libdata.NatsClientToRemoveInFavorOfDriver, err = nats.Connect(os.Getenv("NATS_HOST"))
if err != nil {
fmt.Printf("Impossible to connect to NATS: %v\n", err)
}
fmt.Println(os.Getenv("DATABASE_URL"))
postgresDriver := &postgres.Driver{}
postgresInfo := libdata.ClusterInfo{
Driver: postgresDriver,
URL: os.Getenv("DATABASE_URL"),
}
liborm.Cluster, err = libdata.InitDB(false, &postgresInfo, &postgresInfo, nil)
if err != nil {
log.Fatalf("Error initializing db %s", err.Error())
}
// fmt.Println(os.Getenv("DATABASE_URL"))
// postgresDriver := &postgres.Driver{}
// postgresInfo := libdata.ClusterInfo{
// Driver: postgresDriver,
// URL: os.Getenv("DATABASE_URL"),
// }
// liborm.Cluster, err = libdata.InitDB(false, &postgresInfo, &postgresInfo, nil)
// if err != nil {
// log.Fatalf("Error initializing db %s", err.Error())
// }
liborm.Cluster.CacheDriver = &memory.Driver{}
liborm.Cluster.Register(genorm.ProductDefinition.Model)
liborm.Cluster.Register(genorm.EventDefinition.Model)
libdata.EventDriver = postgresDriver
// libdata.EventDriver = postgresDriver
log.Println("Schema loaded...")
......
package orm
import (
"fmt"
"log"
"os"
"gitlab.com/empowerlab/stack/lib-go/libdata"
"gitlab.com/empowerlab/stack/lib-go/libdata/drivers/postgres"
"gitlab.com/empowerlab/stack/lib-go/libdata/fields"
"gitlab.com/empowerlab/stack/lib-go/libdata/specials"
"gitlab.com/empowerlab/stack/lib-go/liborm"
......@@ -11,13 +16,26 @@ var Definitions *liborm.Definitions
func init() {
fmt.Println(os.Getenv("DATABASE_URL"))
postgresDriver := &postgres.Driver{}
postgresInfo := &libdata.ClusterInfo{
Driver: postgresDriver,
URL: os.Getenv("DATABASE_URL"),
}
var err error
liborm.Cluster, err = libdata.InitDB(false, postgresInfo, postgresInfo, nil)
if err != nil {
log.Fatalf("Error initializing db %s", err.Error())
}
Definitions = &liborm.Definitions{
Repository: "gitlab.com/empowerlab/example/service-product",
}
Definitions.Register(&liborm.Definition{
Model: &libdata.ModelDefinition{
Name: "product",
Cluster: liborm.Cluster,
Name: "product",
Fields: []libdata.Field{
&fields.Text{Name: "name", Required: true},
&fields.Float{Name: "price", Required: true},
......@@ -27,6 +45,8 @@ func init() {
},
})
specials.EventModel.Cluster = liborm.Cluster
libdata.EventDriver = postgresDriver
Definitions.Register(&liborm.Definition{
Model: specials.EventModel,
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment