當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Context.Int方法代碼示例

本文整理匯總了Golang中github.com/cloud66/cli.Context.Int方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.Int方法的具體用法?Golang Context.Int怎麽用?Golang Context.Int使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloud66/cli.Context的用法示例。


在下文中一共展示了Context.Int方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: runNewBackup

func runNewBackup(c *cli.Context) {
	stack := mustStack(c)

	var flagDbTypes *string

	if c.IsSet("dbtypes") {
		flagDbTypes = new(string)
		*flagDbTypes = c.String("dbtypes")
	}

	var flagFrequency *string

	if c.IsSet("frequency") {
		flagFrequency = new(string)
		*flagFrequency = c.String("frequency")
	}

	var flagKeep *int

	if c.IsSet("keep") {
		flagKeep = new(int)
		*flagKeep = c.Int("keep")
	}

	var flagGzip *bool

	if c.IsSet("gzip") {
		flagGzip = new(bool)
		*flagGzip = c.Bool("gzip")
	}

	var flagExcludetables *string

	if c.IsSet("exclude-tables") {
		flagExcludetables = new(string)
		*flagExcludetables = c.String("exclude-tables")
	}

	var flagRunonreplica *bool

	if c.IsSet("run-on-replica") {
		flagRunonreplica = new(bool)
		*flagRunonreplica = c.Bool("run-on-replica")
	}

	err := client.NewBackup(stack.Uid, flagDbTypes, flagFrequency, flagKeep, flagGzip, flagExcludetables, flagRunonreplica)

	if err != nil {
		printFatal("Error during backup creation: " + err.Error())
		return
	}

	fmt.Println("queued for creation")
}
開發者ID:sgtpepper43,項目名稱:cx,代碼行數:54,代碼來源:backups-new.go

示例2: runLease

func runLease(c *cli.Context) {
	stack := mustStack(c)

	from := c.String("from")
	tto := c.Int("tto")
	port := c.Int("port")

	fmt.Printf("Attempting to lease from %s to port %d for %d minutes...\n", from, port, tto)
	genericRes, err := client.LeaseSync(stack.Uid, &from, &tto, &port, nil)
	if err != nil {
		printFatal(err.Error())
	}
	printGenericResponse(*genericRes)
}
開發者ID:sgtpepper43,項目名稱:cx,代碼行數:14,代碼來源:lease.go


注:本文中的github.com/cloud66/cli.Context.Int方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。