コード例 #1
0
ファイル: table_constraints.go プロジェクト: jlovison/modelq
func (o _TableConstraintsObjs) toTableConstraints(columns []gmq.Column, rb []sql.RawBytes) TableConstraints {
	obj := TableConstraints{}
	if len(columns) == len(rb) {
		for i := range columns {
			switch columns[i].Name {
			case "constraint_catalog":
				obj.ConstraintCatalog = gmq.AsString(rb[i])
			case "constraint_schema":
				obj.ConstraintSchema = gmq.AsString(rb[i])
			case "constraint_name":
				obj.ConstraintName = gmq.AsString(rb[i])
			case "table_catalog":
				obj.TableCatalog = gmq.AsString(rb[i])
			case "table_schema":
				obj.TableSchema = gmq.AsString(rb[i])
			case "table_name":
				obj.TableName = gmq.AsString(rb[i])
			case "constraint_type":
				obj.ConstraintType = gmq.AsString(rb[i])
			case "is_deferrable":
				obj.IsDeferrable = gmq.AsString(rb[i])
			case "initially_deferred":
				obj.InitiallyDeferred = gmq.AsString(rb[i])
			}
		}
	}
	return obj
}
コード例 #2
0
ファイル: columns.go プロジェクト: jlovison/modelq
func (o _ColumnsObjs) toColumns(columns []gmq.Column, rb []sql.RawBytes) Columns {
	obj := Columns{}
	if len(columns) == len(rb) {
		for i := range columns {
			switch columns[i].Name {
			case "table_catalog":
				obj.TableCatalog = gmq.AsString(rb[i])
			case "table_schema":
				obj.TableSchema = gmq.AsString(rb[i])
			case "table_name":
				obj.TableName = gmq.AsString(rb[i])
			case "column_name":
				obj.ColumnName = gmq.AsString(rb[i])
			case "ordinal_position":
				obj.OrdinalPosition = gmq.AsInt(rb[i])
			case "column_default":
				obj.ColumnDefault = gmq.AsString(rb[i])
			case "is_nullable":
				obj.IsNullable = gmq.AsString(rb[i])
			case "data_type":
				obj.DataType = gmq.AsString(rb[i])
			case "character_maximum_length":
				obj.CharacterMaximumLength = gmq.AsInt(rb[i])
			case "character_octet_length":
				obj.CharacterOctetLength = gmq.AsInt(rb[i])
			case "numeric_precision":
				obj.NumericPrecision = gmq.AsInt(rb[i])
			case "numeric_precision_radix":
				obj.NumericPrecisionRadix = gmq.AsInt(rb[i])
			case "numeric_scale":
				obj.NumericScale = gmq.AsInt(rb[i])
			case "datetime_precision":
				obj.DatetimePrecision = gmq.AsInt(rb[i])
			case "interval_type":
				obj.IntervalType = gmq.AsString(rb[i])
			case "interval_precision":
				obj.IntervalPrecision = gmq.AsInt(rb[i])
			case "character_set_catalog":
				obj.CharacterSetCatalog = gmq.AsString(rb[i])
			case "character_set_schema":
				obj.CharacterSetSchema = gmq.AsString(rb[i])
			case "character_set_name":
				obj.CharacterSetName = gmq.AsString(rb[i])
			case "collation_catalog":
				obj.CollationCatalog = gmq.AsString(rb[i])
			case "collation_schema":
				obj.CollationSchema = gmq.AsString(rb[i])
			case "collation_name":
				obj.CollationName = gmq.AsString(rb[i])
			case "domain_catalog":
				obj.DomainCatalog = gmq.AsString(rb[i])
			case "domain_schema":
				obj.DomainSchema = gmq.AsString(rb[i])
			case "domain_name":
				obj.DomainName = gmq.AsString(rb[i])
			case "udt_catalog":
				obj.UdtCatalog = gmq.AsString(rb[i])
			case "udt_schema":
				obj.UdtSchema = gmq.AsString(rb[i])
			case "udt_name":
				obj.UdtName = gmq.AsString(rb[i])
			case "scope_catalog":
				obj.ScopeCatalog = gmq.AsString(rb[i])
			case "scope_schema":
				obj.ScopeSchema = gmq.AsString(rb[i])
			case "scope_name":
				obj.ScopeName = gmq.AsString(rb[i])
			case "maximum_cardinality":
				obj.MaximumCardinality = gmq.AsInt(rb[i])
			case "dtd_identifier":
				obj.DtdIdentifier = gmq.AsString(rb[i])
			case "is_self_referencing":
				obj.IsSelfReferencing = gmq.AsString(rb[i])
			case "is_identity":
				obj.IsIdentity = gmq.AsString(rb[i])
			case "identity_generation":
				obj.IdentityGeneration = gmq.AsString(rb[i])
			case "identity_start":
				obj.IdentityStart = gmq.AsString(rb[i])
			case "identity_increment":
				obj.IdentityIncrement = gmq.AsString(rb[i])
			case "identity_maximum":
				obj.IdentityMaximum = gmq.AsString(rb[i])
			case "identity_minimum":
				obj.IdentityMinimum = gmq.AsString(rb[i])
			case "identity_cycle":
				obj.IdentityCycle = gmq.AsString(rb[i])
			case "is_generated":
				obj.IsGenerated = gmq.AsString(rb[i])
			case "generation_expression":
				obj.GenerationExpression = gmq.AsString(rb[i])
			case "is_updatable":
				obj.IsUpdatable = gmq.AsString(rb[i])
			}
		}
	}
	return obj
}
コード例 #3
0
ファイル: COLUMNS.go プロジェクト: jlovison/modelq
func (o _ColumnsObjs) toColumns(columns []gmq.Column, rb []sql.RawBytes) Columns {
	obj := Columns{}
	if len(columns) == len(rb) {
		for i := range columns {
			switch columns[i].Name {
			case "TABLE_CATALOG":
				obj.TableCatalog = gmq.AsString(rb[i])
			case "TABLE_SCHEMA":
				obj.TableSchema = gmq.AsString(rb[i])
			case "TABLE_NAME":
				obj.TableName = gmq.AsString(rb[i])
			case "COLUMN_NAME":
				obj.ColumnName = gmq.AsString(rb[i])
			case "ORDINAL_POSITION":
				obj.OrdinalPosition = gmq.AsInt64(rb[i])
			case "COLUMN_DEFAULT":
				obj.ColumnDefault = gmq.AsString(rb[i])
			case "IS_NULLABLE":
				obj.IsNullable = gmq.AsString(rb[i])
			case "DATA_TYPE":
				obj.DataType = gmq.AsString(rb[i])
			case "CHARACTER_MAXIMUM_LENGTH":
				obj.CharacterMaximumLength = gmq.AsInt64(rb[i])
			case "CHARACTER_OCTET_LENGTH":
				obj.CharacterOctetLength = gmq.AsInt64(rb[i])
			case "NUMERIC_PRECISION":
				obj.NumericPrecision = gmq.AsInt64(rb[i])
			case "NUMERIC_SCALE":
				obj.NumericScale = gmq.AsInt64(rb[i])
			case "DATETIME_PRECISION":
				obj.DatetimePrecision = gmq.AsInt64(rb[i])
			case "CHARACTER_SET_NAME":
				obj.CharacterSetName = gmq.AsString(rb[i])
			case "COLLATION_NAME":
				obj.CollationName = gmq.AsString(rb[i])
			case "COLUMN_TYPE":
				obj.ColumnType = gmq.AsString(rb[i])
			case "COLUMN_KEY":
				obj.ColumnKey = gmq.AsString(rb[i])
			case "EXTRA":
				obj.Extra = gmq.AsString(rb[i])
			case "PRIVILEGES":
				obj.Privileges = gmq.AsString(rb[i])
			case "COLUMN_COMMENT":
				obj.ColumnComment = gmq.AsString(rb[i])
			}
		}
	}
	return obj
}