Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Reindert Vetter committed May 4, 2021
1 parent 28c8f4b commit 8b03781
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
11 changes: 10 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ module github.com/confetti-framework/contract
go 1.15

require (
github.com/confetti-framework/support v0.2.3
github.com/confetti-framework/errors v0.11.0 // indirect
github.com/confetti-framework/support v0.4.0
github.com/confetti-framework/syslog v0.1.1
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/jedib0t/go-pretty/v6 v6.2.1
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-runewidth v0.0.12 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/stretchr/testify v1.7.0 // indirect
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
github.com/confetti-framework/errors v0.11.0-rc.1 h1:Docd/3JG4DwVAiz/KSXnO31fS4wv3rWFPLhgv9c9KVI=
github.com/confetti-framework/errors v0.11.0-rc.1/go.mod h1:a59waUvDS3t8nOeqI0yQDrhILEicAvlca7Kbeilsrao=
github.com/confetti-framework/errors v0.11.0 h1:rIOBgIpw5zGb25q5Pfg2cIk4vMCQb+Gs/kdaEze7BHY=
github.com/confetti-framework/errors v0.11.0/go.mod h1:a59waUvDS3t8nOeqI0yQDrhILEicAvlca7Kbeilsrao=
github.com/confetti-framework/support v0.2.0-rc.1 h1:LSF3NDIVqPpRJEEj4r+4N1PoJfAvGxe0Hdr2sNHwJ60=
github.com/confetti-framework/support v0.2.0-rc.1/go.mod h1:uwOTcc+vAtkzr5GihkCzjv11YVI15UJMhfU2HLRCk/A=
github.com/confetti-framework/support v0.4.0 h1:C42pHjAYQRyRWSGh6WIqsXZA7W7SVeW59Z4wQNnRqvI=
github.com/confetti-framework/support v0.4.0/go.mod h1:QRyVoK7322wmTnLhEzwmZKjVM4didk+w4DhpjaAI8Gc=
github.com/confetti-framework/syslog v0.1.0-rc h1:BqzyW2p9uSxYOL1MQFrMGAcsix7X5nW8bgHlf7SuZkM=
github.com/confetti-framework/syslog v0.1.0-rc/go.mod h1:O6eT3y5cYDGQSVT6lrhScB5NKdylG0R304PmGiChm7Y=
github.com/confetti-framework/syslog v0.1.1 h1:ZYea1UXjp/m1DajS6regPislq+kUhe6+/RpNzCaJ8js=
Expand All @@ -13,6 +17,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E=
github.com/jedib0t/go-pretty/v6 v6.1.0 h1:NVS2PT3ZvzMb47DzS50cmsK6xkf8SSyLfroSSIG20JI=
github.com/jedib0t/go-pretty/v6 v6.1.0/go.mod h1:+nE9fyyHGil+PuISTCrp7avEdo6bqoMwqZnuiK2r2a0=
github.com/jedib0t/go-pretty/v6 v6.2.1 h1:O/3XdNfyWSyVLLIt1EeDhfP8AhNMjtBSh0MuZ4frg6U=
github.com/jedib0t/go-pretty/v6 v6.2.1/go.mod h1:+nE9fyyHGil+PuISTCrp7avEdo6bqoMwqZnuiK2r2a0=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand All @@ -23,9 +29,14 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -36,7 +47,10 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c h1:uHnKXcvx6SNkuwC+nrzxkJ+TpPwZOtumbhWrrOYN5YA=
golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6 h1:cdsMqa2nXzqlgs183pHxtvoVwU7CyzaCTAUOg94af4c=
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
17 changes: 11 additions & 6 deletions inter/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,30 @@ const AppProvider = "app_provider"
type App interface {
AppReader

// GetE the service container
// Container returns the service container
Container() *Container

// Set the service container
// SetContainer set the service container
SetContainer(container Container)

// Register a shared binding in the container.
// Singleton registered a shared binding in the container.
Singleton(abstract interface{}, concrete interface{})

// Register an existing instance as shared in the container.
// Bind registered an existing instance as shared in the container.
Bind(abstract interface{}, concrete interface{})

// Register an existing instance as shared in the container without an abstract
// Instance registered an existing instance as shared in the container without an abstract
Instance(concrete interface{}) interface{}

Environment() (string, error)

IsEnvironment(environments ...string) bool

// The Log method gives you an instance of a logger. You can write your log messages to this instance.
// The Log method gives you an instance of a logger. You can write your log
// messages to this instance.
Log(channels ...string) LoggerFacade

// Db returns the database facade. If no parameters are provided, it will use
// the default connection.
Db(connection ...string) Database
}
27 changes: 27 additions & 0 deletions inter/database.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package inter

import (
"database/sql"
"github.com/confetti-framework/support"
"time"
)

type Cache interface {
GetE(string) (support.Value, error)
}

type Connection interface {
Open() error
Pool() *sql.DB
Timeout() time.Duration
}

type Database interface {
Connection() Connection
Exec(sql string, args ...interface{}) sql.Result
ExecE(sql string, args ...interface{}) (sql.Result, error)
Query(sql string, args ...interface{}) support.Collection
QueryE(sql string, args ...interface{}) (support.Collection, error)
}

type TypeCast func(ct sql.ColumnType, raw []byte) interface{}

0 comments on commit 8b03781

Please sign in to comment.