当前位置: 首页>>代码示例>>Golang>>正文


Golang migration.Migration类代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs/migration.Migration的典型用法代码示例。如果您正苦于以下问题:Golang Migration类的具体用法?Golang Migration怎么用?Golang Migration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Migration类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: AppendMigration

func AppendMigration(migration migration.Migration) {
	for _, m := range Migrations {
		if m.Version() == migration.Version() {
			panic("cannot have two migrations with the same version")
		}
	}

	Migrations = append(Migrations, migration)
}
开发者ID:emc-xchallenge,项目名称:bbs,代码行数:9,代码来源:migrations.go

示例2:

	"github.com/cloudfoundry-incubator/bbs/encryption"
	"github.com/cloudfoundry-incubator/bbs/format"
	"github.com/cloudfoundry-incubator/bbs/migration"
	"github.com/cloudfoundry-incubator/bbs/models"
	"github.com/cloudfoundry-incubator/bbs/models/test/model_helpers"
	goetcd "github.com/coreos/go-etcd/etcd"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("Base 64 Protobuf Encode Migration", func() {
	var (
		migration  migration.Migration
		serializer format.Serializer
		cryptor    encryption.Cryptor

		logger *lagertest.TestLogger
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")

		encryptionKey, err := encryption.NewKey("label", "passphrase")
		Expect(err).NotTo(HaveOccurred())
		keyManager, err := encryption.NewKeyManager(encryptionKey, nil)
		Expect(err).NotTo(HaveOccurred())
		cryptor = encryption.NewCryptor(keyManager, rand.Reader)
		serializer = format.NewSerializer(cryptor)
		migration = migrations.NewBase64ProtobufEncode()
	})
开发者ID:timani,项目名称:bbs,代码行数:31,代码来源:1441411196_base64_protobuf_encode_test.go

示例3:

	"github.com/cloudfoundry-incubator/bbs/db/migrations"
	"github.com/cloudfoundry-incubator/bbs/encryption"
	"github.com/cloudfoundry-incubator/bbs/format"
	"github.com/cloudfoundry-incubator/bbs/migration"
	"github.com/cloudfoundry-incubator/bbs/models"
	"github.com/cloudfoundry-incubator/bbs/models/test/model_helpers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("Change Timeouts to Milliseconds Migration", func() {
	var (
		migration  migration.Migration
		serializer format.Serializer
		cryptor    encryption.Cryptor
		db         *etcddb.ETCDDB

		logger *lagertest.TestLogger
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")

		encryptionKey, err := encryption.NewKey("label", "passphrase")
		Expect(err).NotTo(HaveOccurred())
		keyManager, err := encryption.NewKeyManager(encryptionKey, nil)
		Expect(err).NotTo(HaveOccurred())
		cryptor = encryption.NewCryptor(keyManager, rand.Reader)
		serializer = format.NewSerializer(cryptor)
		migration = migrations.NewTimeoutMilliseconds()
		db = etcddb.NewETCD(format.ENCRYPTED_PROTO, 1, 1, 1*time.Minute, cryptor, storeClient, fakeClock)
开发者ID:timani,项目名称:bbs,代码行数:32,代码来源:1451635200_timeouts_to_milliseconds_test.go

示例4:

	etcddb "github.com/cloudfoundry-incubator/bbs/db/etcd"
	"github.com/cloudfoundry-incubator/bbs/db/migrations"
	"github.com/cloudfoundry-incubator/bbs/format"
	"github.com/cloudfoundry-incubator/bbs/migration"
	"github.com/cloudfoundry-incubator/bbs/models"
	"github.com/cloudfoundry-incubator/bbs/models/test/model_helpers"
	"github.com/cloudfoundry-incubator/bbs/test_helpers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("ETCD to SQL Migration", func() {
	if test_helpers.UseSQL() {
		var (
			migration    migration.Migration
			serializer   format.Serializer
			migrationErr error
		)

		BeforeEach(func() {
			migration = migrations.NewETCDToSQL()
			serializer = format.NewSerializer(cryptor)

			rawSQLDB.Exec("DROP TABLE domains;")
			rawSQLDB.Exec("DROP TABLE tasks;")
			rawSQLDB.Exec("DROP TABLE desired_lrps;")
			rawSQLDB.Exec("DROP TABLE actual_lrps;")
		})

		It("appends itself to the migration list", func() {
			Expect(migrations.Migrations).To(ContainElement(migration))
开发者ID:timani,项目名称:bbs,代码行数:31,代码来源:1461790966_etcd_to_sql_test.go


注:本文中的github.com/cloudfoundry-incubator/bbs/migration.Migration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。