コード例 #1
0
func (o _KeyColumnUsageObjs) toKeyColumnUsage(columns []gmq.Column, rb []sql.RawBytes) KeyColumnUsage {
	obj := KeyColumnUsage{}
	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 "column_name":
				obj.ColumnName = gmq.AsString(rb[i])
			case "ordinal_position":
				obj.OrdinalPosition = gmq.AsInt(rb[i])
			case "position_in_unique_constraint":
				obj.PositionInUniqueConstraint = gmq.AsInt(rb[i])
			}
		}
	}
	return obj
}
コード例 #2
0
ファイル: article.go プロジェクト: elliott-stroud/modelq
func (o _ArticleObjs) toArticle(columns []gmq.Column, rb []sql.RawBytes) Article {
	obj := Article{}
	if len(columns) == len(rb) {
		for i := range columns {
			switch columns[i].Name {
			case "id":
				obj.Id = gmq.AsInt64(rb[i])
			case "user_id":
				obj.UserId = gmq.AsInt64(rb[i])
			case "title":
				obj.Title = gmq.AsString(rb[i])
			case "state":
				obj.State = gmq.AsInt(rb[i])
			case "content":
				obj.Content = gmq.AsString(rb[i])
			case "donation":
				obj.Donation = gmq.AsFloat64(rb[i])
			case "create_time":
				obj.CreateTime = gmq.AsTime(rb[i])
			case "update_time":
				obj.UpdateTime = gmq.AsTime(rb[i])
			}
		}
	}
	return obj
}
コード例 #3
0
ファイル: user.go プロジェクト: elliott-stroud/modelq
func (o _UserObjs) toUser(columns []gmq.Column, rb []sql.RawBytes) User {
	obj := User{}
	if len(columns) == len(rb) {
		for i := range columns {
			switch columns[i].Name {
			case "id":
				obj.Id = gmq.AsInt64(rb[i])
			case "name":
				obj.Name = gmq.AsString(rb[i])
			case "password":
				obj.Password = gmq.AsString(rb[i])
			case "is_married":
				obj.IsMarried = gmq.AsInt(rb[i])
			case "age":
				obj.Age = gmq.AsInt(rb[i])
			case "create_time":
				obj.CreateTime = gmq.AsTime(rb[i])
			case "update_time":
				obj.UpdateTime = gmq.AsTime(rb[i])
			}
		}
	}
	return obj
}
コード例 #4
0
ファイル: columns.go プロジェクト: elliott-stroud/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
}