Exemple #1
0
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
}
Exemple #2
0
func (o _CommentObjs) toComment(columns []gmq.Column, rb []sql.RawBytes) Comment {
	obj := Comment{}
	if len(columns) == len(rb) {
		for i := range columns {
			switch columns[i].Name {
			case "user_id":
				obj.UserId = gmq.AsInt64(rb[i])
			case "article_id":
				obj.ArticleId = gmq.AsInt64(rb[i])
			case "content":
				obj.Content = gmq.AsString(rb[i])
			case "create_time":
				obj.CreateTime = gmq.AsTime(rb[i])
			case "update_time":
				obj.UpdateTime = gmq.AsTime(rb[i])
			}
		}
	}
	return obj
}
Exemple #3
0
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
}