本文整理匯總了Golang中github.com/concourse/atc/db.PipelineDBFactory類的典型用法代碼示例。如果您正苦於以下問題:Golang PipelineDBFactory類的具體用法?Golang PipelineDBFactory怎麽用?Golang PipelineDBFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了PipelineDBFactory類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewHandler
func NewHandler(
logger lager.Logger,
pipelineDBFactory db.PipelineDBFactory,
pipelineHandler func(db.PipelineDB) http.Handler,
template *template.Template,
) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
pipelineDB, err := pipelineDBFactory.BuildDefault()
if err != nil {
if err == db.ErrNoPipelines {
err = template.Execute(w, TemplateData{})
if err != nil {
log.Fatal("failed-to-task-template", err, lager.Data{})
}
return
}
logger.Error("failed-to-load-pipelinedb", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
pipelineHandler(pipelineDB).ServeHTTP(w, r)
})
}
示例2: NewHandler
func NewHandler(
logger lager.Logger,
pipelineDBFactory db.PipelineDBFactory,
pipelineHandler http.Handler,
template *template.Template,
) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log := logger.Session("index")
pipelineDB, found, err := pipelineDBFactory.BuildDefault()
if err != nil {
log.Error("failed-to-load-pipelinedb", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
if !found {
err = template.Execute(w, TemplateData{})
if err != nil {
log.Fatal("failed-to-build-template", err, lager.Data{})
}
return
}
if r.Form == nil {
r.Form = url.Values{}
}
r.Form[":pipeline"] = []string{pipelineDB.GetPipelineName()}
pipelineHandler.ServeHTTP(w, r)
})
}
示例3:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/sclevine/agouti/matchers"
"github.com/cloudfoundry/gunk/urljoiner"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
"github.com/concourse/atc/event"
)
var _ = Describe("One-off Builds", func() {
var atcProcess ifrit.Process
var dbListener *pq.Listener
var atcPort uint16
var pipelineDBFactory db.PipelineDBFactory
BeforeEach(func() {
dbLogger := lagertest.NewTestLogger("test")
postgresRunner.Truncate()
dbConn = postgresRunner.Open()
dbListener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
bus := db.NewNotificationsBus(dbListener, dbConn)
sqlDB = db.NewSQL(dbLogger, dbConn, bus)
pipelineDBFactory = db.NewPipelineDBFactory(dbLogger, dbConn, bus, sqlDB)
atcProcess, atcPort = startATC(atcBin, 1)
})
AfterEach(func() {
ginkgomon.Interrupt(atcProcess)
示例4:
"time"
"github.com/concourse/atc/db"
"github.com/concourse/atc/db/fakes"
"github.com/lib/pq"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("PipelineDBFactory", func() {
var dbConn db.Conn
var listener *pq.Listener
var pipelineDBFactory db.PipelineDBFactory
var pipelinesDB *fakes.FakePipelinesDB
BeforeEach(func() {
postgresRunner.Truncate()
dbConn = db.Wrap(postgresRunner.Open())
listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
bus := db.NewNotificationsBus(listener, dbConn)
pipelinesDB = new(fakes.FakePipelinesDB)
pipelineDBFactory = db.NewPipelineDBFactory(lagertest.NewTestLogger("test"), dbConn, bus, pipelinesDB)
示例5:
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/sclevine/agouti/matchers"
"github.com/cloudfoundry/gunk/urljoiner"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
)
var _ = Describe("Pipeline Pausing", func() {
var atcProcess ifrit.Process
var dbListener *pq.Listener
var atcPort uint16
var pipelineDBFactory db.PipelineDBFactory
BeforeEach(func() {
dbLogger := lagertest.NewTestLogger("test")
postgresRunner.Truncate()
dbConn = db.Wrap(postgresRunner.Open())
dbListener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
bus := db.NewNotificationsBus(dbListener, dbConn)
sqlDB = db.NewSQL(dbLogger, dbConn, bus)
pipelineDBFactory = db.NewPipelineDBFactory(dbLogger, dbConn, bus, sqlDB)
atcProcess, atcPort = startATC(atcBin, 1, true, BASIC_AUTH)
err := sqlDB.DeleteTeamByName(atc.DefaultTeamName)
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
示例6:
"time"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
"github.com/lib/pq"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Resource History", func() {
var dbConn *sql.DB
var listener *pq.Listener
var pipelineDBFactory db.PipelineDBFactory
var sqlDB *db.SQLDB
var pipelineDB db.PipelineDB
var otherPipelineDB db.PipelineDB
BeforeEach(func() {
postgresRunner.Truncate()
dbConn = postgresRunner.Open()
listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
bus := db.NewNotificationsBus(listener, dbConn)
sqlDB = db.NewSQL(lagertest.NewTestLogger("test"), dbConn, bus)
pipelineDBFactory = db.NewPipelineDBFactory(lagertest.NewTestLogger("test"), dbConn, bus, sqlDB)
示例7:
"github.com/lib/pq"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager/lagertest"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
)
var _ = Describe("SQL DB", func() {
var dbConn *sql.DB
var listener *pq.Listener
var sqlDB *db.SQLDB
var pipelineDB db.PipelineDB
var pipelineDBFactory db.PipelineDBFactory
var dbSharedBehaviorInput = dbSharedBehaviorInput{}
BeforeEach(func() {
var err error
postgresRunner.Truncate()
dbConn = postgresRunner.Open()
listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
bus := db.NewNotificationsBus(listener, dbConn)
sqlDB = db.NewSQL(lagertest.NewTestLogger("test"), dbConn, bus)
示例8:
"time"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
"github.com/lib/pq"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Resource History", func() {
var dbConn db.Conn
var listener *pq.Listener
var pipelineDBFactory db.PipelineDBFactory
var sqlDB *db.SQLDB
var pipelineDB db.PipelineDB
BeforeEach(func() {
postgresRunner.Truncate()
dbConn = db.Wrap(postgresRunner.Open())
listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
bus := db.NewNotificationsBus(listener, dbConn)
sqlDB = db.NewSQL(lagertest.NewTestLogger("test"), dbConn, bus)
pipelineDBFactory = db.NewPipelineDBFactory(lagertest.NewTestLogger("test"), dbConn, bus, sqlDB)
示例9:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/sclevine/agouti/matchers"
"github.com/cloudfoundry/gunk/urljoiner"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
"github.com/concourse/atc/event"
)
var _ = Describe("Job Pausing", func() {
var atcProcess ifrit.Process
var dbListener *pq.Listener
var atcPort uint16
var pipelineDBFactory db.PipelineDBFactory
var pipelineDB db.PipelineDB
BeforeEach(func() {
dbLogger := lagertest.NewTestLogger("test")
postgresRunner.Truncate()
dbConn = db.Wrap(postgresRunner.Open())
dbListener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
bus := db.NewNotificationsBus(dbListener, dbConn)
sqlDB = db.NewSQL(dbLogger, dbConn, bus)
pipelineDBFactory = db.NewPipelineDBFactory(dbLogger, dbConn, bus, sqlDB)
atcProcess, atcPort = startATC(atcBin, 1, true, BASIC_AUTH)
_, err := dbConn.Query(`DELETE FROM teams WHERE name = 'main'`)
Expect(err).NotTo(HaveOccurred())
})
示例10:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
. "github.com/sclevine/agouti/matchers"
"github.com/cloudfoundry/gunk/urljoiner"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
"github.com/concourse/atc/event"
)
var _ = Describe("Resource Pausing", func() {
var atcProcess ifrit.Process
var dbListener *pq.Listener
var atcPort uint16
var pipelineDBFactory db.PipelineDBFactory
BeforeEach(func() {
atcBin, err := gexec.Build("github.com/concourse/atc/cmd/atc")
Ω(err).ShouldNot(HaveOccurred())
dbLogger := lagertest.NewTestLogger("test")
postgresRunner.CreateTestDB()
dbConn = postgresRunner.Open()
dbListener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
bus := db.NewNotificationsBus(dbListener)
sqlDB = db.NewSQL(dbLogger, dbConn, bus)
pipelineDBFactory = db.NewPipelineDBFactory(dbLogger, dbConn, bus, sqlDB)
atcProcess, atcPort = startATC(atcBin, 1)
})
示例11:
"github.com/concourse/atc"
"github.com/concourse/atc/db"
"github.com/lib/pq"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Leases", func() {
var (
dbConn db.Conn
listener *pq.Listener
pipelineDBFactory db.PipelineDBFactory
sqlDB *db.SQLDB
pipelineDB db.PipelineDB
)
BeforeEach(func() {
postgresRunner.Truncate()
dbConn = db.Wrap(postgresRunner.Open())
listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
bus := db.NewNotificationsBus(listener, dbConn)
sqlDB = db.NewSQL(lagertest.NewTestLogger("test"), dbConn, bus)
示例12:
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
. "github.com/sclevine/agouti/matchers"
"github.com/cloudfoundry/gunk/urljoiner"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
)
var _ = Describe("Resource Pagination", func() {
var atcProcess ifrit.Process
var dbListener *pq.Listener
var pipelineDBFactory db.PipelineDBFactory
var atcPort uint16
BeforeEach(func() {
atcBin, err := gexec.Build("github.com/concourse/atc/cmd/atc")
Ω(err).ShouldNot(HaveOccurred())
dbLogger := lagertest.NewTestLogger("test")
postgresRunner.CreateTestDB()
dbConn = postgresRunner.Open()
dbListener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
bus := db.NewNotificationsBus(dbListener)
sqlDB = db.NewSQL(dbLogger, dbConn, bus)
Ω(err).ShouldNot(HaveOccurred())
示例13:
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/sclevine/agouti/matchers"
"github.com/cloudfoundry/gunk/urljoiner"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
)
var _ = Describe("Pipeline Pausing", func() {
var atcProcess ifrit.Process
var dbListener *pq.Listener
var atcPort uint16
var pipelineDBFactory db.PipelineDBFactory
BeforeEach(func() {
dbLogger := lagertest.NewTestLogger("test")
postgresRunner.Truncate()
dbConn = postgresRunner.Open()
dbListener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
bus := db.NewNotificationsBus(dbListener, dbConn)
sqlDB = db.NewSQL(dbLogger, dbConn, bus)
pipelineDBFactory = db.NewPipelineDBFactory(dbLogger, dbConn, bus, sqlDB)
atcProcess, atcPort = startATC(atcBin, 1)
})
AfterEach(func() {
ginkgomon.Interrupt(atcProcess)
示例14:
"github.com/lib/pq"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager/lagertest"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
)
var _ = Describe("Keeping track of pipeline configs", func() {
var dbConn db.Conn
var listener *pq.Listener
var database *db.SQLDB
var pipelineDBFactory db.PipelineDBFactory
var team db.SavedTeam
var config atc.Config
var otherConfig atc.Config
BeforeEach(func() {
postgresRunner.Truncate()
dbConn = db.Wrap(postgresRunner.Open())
listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
bus := db.NewNotificationsBus(listener, dbConn)