Esempio n. 1
0
// NewWithColumns creates a image from database columns - used by query in creating objects
func NewWithColumns(cols map[string]interface{}) *Image {

	image := New()
	image.Id = validate.Int(cols["id"])
	image.CreatedAt = validate.Time(cols["created_at"])
	image.UpdatedAt = validate.Time(cols["updated_at"])
	image.Status = validate.Int(cols["status"])
	image.Name = validate.String(cols["name"])
	image.Path = validate.String(cols["path"])
	image.Sort = validate.Int(cols["sort"])

	return image
}
Esempio n. 2
0
// NewWithColumns creates a new post instance and fills it with data from the database cols provided
func NewWithColumns(cols map[string]interface{}) *Post {

	post := New()
	post.Id = validate.Int(cols["id"])
	post.CreatedAt = validate.Time(cols["created_at"])
	post.UpdatedAt = validate.Time(cols["updated_at"])
	post.Status = validate.Int(cols["status"])
	post.AuthorId = validate.Int(cols["author_id"])
	post.Name = validate.String(cols["name"])
	post.Summary = validate.String(cols["summary"])
	post.Text = validate.String(cols["text"])

	return post
}
Esempio n. 3
0
// NewWithColumns creates a new file instance and fills it with data from the database cols provided
func NewWithColumns(cols map[string]interface{}) *File {

	file := New()
	file.Id = validate.Int(cols["id"])
	file.CreatedAt = validate.Time(cols["created_at"])
	file.UpdatedAt = validate.Time(cols["updated_at"])
	file.Status = validate.Int(cols["status"])
	file.Path = validate.String(cols["path"])
	file.Sender = validate.String(cols["sender"])
	file.SenderID = validate.Int(cols["sender_id"])
	file.UserID = validate.Int(cols["user_id"])

	return file
}
Esempio n. 4
0
// NewWithColumns creates a new page instance and fills it with data from the database cols provided
func NewWithColumns(cols map[string]interface{}) *Page {

	page := New()
	page.Id = validate.Int(cols["id"])
	page.CreatedAt = validate.Time(cols["created_at"])
	page.UpdatedAt = validate.Time(cols["updated_at"])
	page.Status = validate.Int(cols["status"])
	page.Keywords = validate.String(cols["keywords"])
	page.Name = validate.String(cols["name"])
	page.Summary = validate.String(cols["summary"])
	page.URL = validate.String(cols["url"])
	page.Text = validate.String(cols["text"])

	return page
}
Esempio n. 5
0
// Create a tag from database columns - used by query in creating objects
func NewWithColumns(cols map[string]interface{}) *Tag {

	tag := New()
	tag.Id = validate.Int(cols["id"])
	tag.CreatedAt = validate.Time(cols["created_at"])
	tag.UpdatedAt = validate.Time(cols["updated_at"])
	tag.ParentId = validate.Int(cols["parent_id"])
	tag.Status = validate.Int(cols["status"])
	tag.Name = validate.String(cols["name"])
	tag.Summary = validate.String(cols["summary"])
	tag.Url = validate.String(cols["url"])
	tag.DottedIds = validate.String(cols["dotted_ids"])

	return tag
}
Esempio n. 6
0
// NewWithColumns creates a new user instance and fills it with data from the database cols provided
func NewWithColumns(cols map[string]interface{}) *User {

	user := New()
	user.Id = validate.Int(cols["id"])
	user.CreatedAt = validate.Time(cols["created_at"])
	user.UpdatedAt = validate.Time(cols["updated_at"])
	user.Status = validate.Int(cols["status"])
	user.Email = validate.String(cols["email"])
	user.Key = validate.String(cols["key"])
	user.Name = validate.String(cols["name"])
	user.Password = validate.String(cols["password"])
	user.Role = validate.Int(cols["role"])
	user.Summary = validate.String(cols["summary"])

	return user
}
Esempio n. 7
0
// NewWithColumns creates a user from database columns - used by query in creating objects
func NewWithColumns(cols map[string]interface{}) *User {

	user := New()
	user.Id = validate.Int(cols["id"])
	user.CreatedAt = validate.Time(cols["created_at"])
	user.UpdatedAt = validate.Time(cols["updated_at"])
	user.Status = validate.Int(cols["status"])
	user.Role = validate.Int(cols["role"])
	user.Name = validate.String(cols["name"])
	user.Summary = validate.String(cols["summary"])
	user.Email = validate.String(cols["email"])
	user.EncryptedPassword = validate.String(cols["encrypted_password"])
	user.Text = validate.String(cols["text"])
	user.Title = validate.String(cols["title"])
	user.ImageID = validate.Int(cols["image_id"])
	return user
}
Esempio n. 8
0
// NewWithColumns creates a new story instance and fills it with data from the database cols provided
func NewWithColumns(cols map[string]interface{}) *Story {

	story := New()
	story.Id = validate.Int(cols["id"])
	story.CreatedAt = validate.Time(cols["created_at"])
	story.UpdatedAt = validate.Time(cols["updated_at"])
	story.Status = validate.Int(cols["status"])
	story.Name = validate.String(cols["name"])
	story.Summary = validate.String(cols["summary"])
	story.Url = validate.String(cols["url"])
	story.Rank = validate.Int(cols["rank"])
	story.Points = validate.Int(cols["points"])

	story.UserId = validate.Int(cols["user_id"])
	story.UserName = validate.String(cols["user_name"])
	story.CommentCount = validate.Int(cols["comment_count"])

	return story
}
Esempio n. 9
0
// NewWithColumns creates a new comment instance and fills it with data from the database cols provided
func NewWithColumns(cols map[string]interface{}) *Comment {

	comment := New()
	comment.Id = validate.Int(cols["id"])
	comment.CreatedAt = validate.Time(cols["created_at"])
	comment.UpdatedAt = validate.Time(cols["updated_at"])
	comment.Status = validate.Int(cols["status"])
	comment.Text = validate.String(cols["text"])
	comment.Points = validate.Int(cols["points"])
	comment.Rank = validate.Int(cols["rank"])

	comment.UserId = validate.Int(cols["user_id"])
	comment.UserName = validate.String(cols["user_name"])

	comment.StoryId = validate.Int(cols["story_id"])
	comment.StoryName = validate.String(cols["story_name"])

	comment.ParentId = validate.Int(cols["parent_id"])
	comment.DottedIds = validate.String(cols["dotted_ids"])

	return comment
}