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


Golang TableInfo.State方法代碼示例

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


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

示例1: testCreateTable

func testCreateTable(c *C, ctx context.Context, d *ddl, dbInfo *model.DBInfo, tblInfo *model.TableInfo) *model.Job {
	job := &model.Job{
		SchemaID: dbInfo.ID,
		TableID:  tblInfo.ID,
		Type:     model.ActionCreateTable,
		Args:     []interface{}{tblInfo},
	}
	err := d.doDDLJob(ctx, job)
	c.Assert(err, IsNil)

	v := getSchemaVer(c, ctx)
	tblInfo.State = model.StatePublic
	checkHistoryJobArgs(c, ctx, job.ID, &historyJobArgs{ver: v, tbl: tblInfo})
	tblInfo.State = model.StateNone
	return job
}
開發者ID:pingcap,項目名稱:tidb,代碼行數:16,代碼來源:table_test.go

示例2: handleAutoIncID

// If create table with auto_increment option, we should rebase tableAutoIncID value.
func (d *ddl) handleAutoIncID(tbInfo *model.TableInfo, schemaID int64) error {
	alloc := autoid.NewAllocator(d.store, schemaID)
	tbInfo.State = model.StatePublic
	tb, err := table.TableFromMeta(alloc, tbInfo)
	if err != nil {
		return errors.Trace(err)
	}
	// The operation of the minus 1 to make sure that the current value doesn't be used,
	// the next Alloc operation will get this value.
	// Its behavior is consistent with MySQL.
	if err = tb.RebaseAutoID(tbInfo.AutoIncID-1, false); err != nil {
		return errors.Trace(err)
	}
	return nil
}
開發者ID:pingcap,項目名稱:tidb,代碼行數:16,代碼來源:ddl.go

示例3: handleTableOptions

func (d *ddl) handleTableOptions(options []*ast.TableOption, tbInfo *model.TableInfo, schemaID int64) error {
	for _, op := range options {
		if op.Tp == ast.TableOptionAutoIncrement {
			alloc := autoid.NewAllocator(d.store, schemaID)
			tbInfo.State = model.StatePublic
			tb, err := table.TableFromMeta(alloc, tbInfo)
			if err != nil {
				return errors.Trace(err)
			}
			// The operation of the minus 1 to make sure that the current value doesn't be used,
			// the next Alloc operation will get this value.
			// Its behavior is consistent with MySQL.
			if err = tb.RebaseAutoID(int64(op.UintValue-1), false); err != nil {
				return errors.Trace(err)
			}
		}
	}

	return nil
}
開發者ID:astaxie,項目名稱:tidb,代碼行數:20,代碼來源:ddl.go


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