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


Golang Service.Delete方法代码示例

本文整理汇总了Golang中github.com/citycloud/citycloud/cf-deploy-ui/entity.Service.Delete方法的典型用法代码示例。如果您正苦于以下问题:Golang Service.Delete方法的具体用法?Golang Service.Delete怎么用?Golang Service.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/citycloud/citycloud/cf-deploy-ui/entity.Service的用法示例。


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

示例1: DeleteCustomService

func (this *TemplatesController) DeleteCustomService() {
	id, err := this.GetInt64("id", 0)
	service := entity.Service{}
	if err == nil && id != 0 {
		service.Id = id
		err = service.Load()
		if err == nil {
			serviceDto := entity.ServiceDto{}
			serviceDto.Service = service
			serviceDto.Load()
			if serviceDto.Service.Where == utils.Deploy_On_PaaS {
				serviceDto.OnPaaS.Delete()
			}
			if serviceDto.Service.Where == utils.Deploy_On_Vms {
				serviceDto.OnCustom.Delete()
			}
		}

		err = service.Delete()
		if err != nil {
			this.Data["MessageErr"] = fmt.Sprintf("Errors: %s", err)
		}
	}
	if err != nil {
		this.Data["MessageErr"] = fmt.Sprintf("Errors: %s", err)
	}
}
开发者ID:alex8023,项目名称:citycloud.cf-deploy-ui,代码行数:27,代码来源:templates.go

示例2:

import (
	"github.com/astaxie/beego/orm"
	"github.com/citycloud/citycloud.cf-deploy-ui/entity"
	_ "github.com/go-sql-driver/mysql"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Testing Service CRUD", func() {
	It("Service Save", func() {
		var service entity.Service = entity.Service{Name: "mysql-service", Description: "provide mysql store service"}
		err := service.Save()
		Expect(err).ToNot(HaveOccurred())

		err = service.Delete()
		Expect(err).ToNot(HaveOccurred())
	})
	It("Service Update", func() {
		service := entity.Service{Name: "mysql-service", Description: "provide mysql store service"}
		id, err := orm.NewOrm().Insert(&service)
		Expect(err).ToNot(HaveOccurred())
		service1 := entity.Service{}
		service1.Id = id
		errs := service1.Load()
		Expect(errs).ToNot(HaveOccurred())
		service1.Name = "New-mysql-service"
		errs = service1.Update()
		Expect(errs).ToNot(HaveOccurred())
		errs = service1.Load()
		Expect(errs).ToNot(HaveOccurred())
开发者ID:alex8023,项目名称:citycloud.cf-deploy-ui,代码行数:30,代码来源:templates_test.go


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