func (n NewsItem) PopulateNewsItem(row mysql.Row, res mysql.Result, ch chan NewsItem) { item := NewsItem{ ID: row.Int(res.Map("newsItemID")), Title: row.Str(res.Map("title")), Lead: row.Str(res.Map("lead")), Content: row.Str(res.Map("content")), PublishStart: row.Time(res.Map("publishStart"), UTC), PublishEnd: row.Time(res.Map("publishEnd"), UTC), Active: row.Bool(res.Map("active")), Slug: row.Str(res.Map("slug")), } ch <- item }
func (c Comment) PopulateComment(row mysql.Row, res mysql.Result, ch chan Comment) { comment := Comment{ ID: row.Int(res.Map("commentID")), PostID: row.Int(res.Map("blogPostID")), Name: row.Str(res.Map("name")), Email: row.Str(res.Map("email")), Comment: row.Str(res.Map("comment_text")), Created: row.Time(res.Map("createdDate"), UTC), Approved: row.Bool(res.Map("approved")), Active: row.Bool(res.Map("active")), } ch <- comment }
func (v Video) PopulateVideo(row mysql.Row, res mysql.Result, ch chan Video) { video := Video{ ID: row.Int(res.Map("videoID")), EmbedLink: row.Str(res.Map("embed_link")), DateAdded: row.Time(res.Map("dateAdded"), UTC), Sort: row.Int(res.Map("sort")), Title: row.Str(res.Map("title")), Description: row.Str(res.Map("description")), YouTubeID: row.Str(res.Map("youtubeID")), WatchPage: row.Str(res.Map("watchpage")), Screenshot: row.Str(res.Map("screenshot")), } ch <- video }
func (c CustomerUser) PopulateUser(row mysql.Row, res mysql.Result, ch chan CustomerUser) { user := CustomerUser{ ID: row.Str(res.Map("id")), CustID: row.Int(res.Map("cust_ID")), CustomerID: row.Int(res.Map("customerID")), Name: row.Str(res.Map("name")), Email: row.Str(res.Map("email")), DateAdded: row.Time(res.Map("date_added"), UTC), Active: row.Bool(res.Map("active")), LocationID: row.Int(res.Map("locationID")), IsSudo: row.Bool(res.Map("isSudo")), NotCustomer: row.Bool(res.Map("NotCustomer")), } ch <- user }
func (t Testimonial) PopulateTestimonial(row mysql.Row, res mysql.Result, ch chan Testimonial) { testimonial := Testimonial{ ID: row.Int(res.Map("testimonialID")), Rating: row.Float(res.Map("rating")), Title: row.Str(res.Map("title")), Content: row.Str(res.Map("testimonial")), DateAdded: row.Time(res.Map("dateAdded"), UTC), Approved: row.Bool(res.Map("approved")), Active: row.Bool(res.Map("active")), FirstName: row.Str(res.Map("first_name")), LastName: row.Str(res.Map("last_name")), Location: row.Str(res.Map("location")), } ch <- testimonial }
func (c CustomerUser) PopulateKey(row mysql.Row, res mysql.Result, ch chan APIKey) { keyType := APIKeyType{ ID: row.Str(res.Map("type_id")), Type: row.Str(res.Map("type")), DateAdded: row.Time(res.Map("typeDateAdded"), UTC), } key := APIKey{ ID: row.Str(res.Map("id")), UserID: row.Str(res.Map("user_id")), Key: row.Str(res.Map("api_key")), TypeID: keyType.ID, DateAdded: row.Time(res.Map("date_added"), UTC), KeyType: keyType, } ch <- key }
func (c Contact) PopulateContact(row mysql.Row, res mysql.Result, ch chan Contact) { contact := Contact{ ID: row.Int(res.Map("contactID")), FirstName: row.Str(res.Map("first_name")), LastName: row.Str(res.Map("last_name")), Email: row.Str(res.Map("email")), Phone: row.Str(res.Map("phone")), Subject: row.Str(res.Map("subject")), Message: row.Str(res.Map("message")), Created: row.Time(res.Map("createdDate"), UTC), Type: row.Str(res.Map("type")), Address1: row.Str(res.Map("address1")), Address2: row.Str(res.Map("address2")), City: row.Str(res.Map("city")), PostalCode: row.Str(res.Map("postalcode")), Country: row.Str(res.Map("country")), } ch <- contact }
func PopulateRevision(row mysql.Row, res mysql.Result, ch chan ContentRevision) { var revision ContentRevision id := res.Map("revisionID") contentID := res.Map("contentID") contentText := res.Map("content_text") createdOn := res.Map("createdOn") active := res.Map("active") revision = ContentRevision{ ID: row.Int(id), ContentID: row.Int(contentID), ContentText: row.Str(contentText), CreatedOn: row.Time(createdOn, UTC), Active: row.Bool(active), } ch <- revision }
func PopulateContent(row mysql.Row, res mysql.Result, ch chan Content) { cid := res.Map("contentID") contentType := res.Map("content_type") pageTitle := res.Map("page_title") createdDate := res.Map("createdDate") lastModified := res.Map("lastModified") metaTitle := res.Map("meta_title") metaDesc := res.Map("meta_description") keywords := res.Map("keywords") isPrimary := res.Map("isPrimary") published := res.Map("published") active := res.Map("active") slug := res.Map("slug") requireAuth := res.Map("requireAuthentication") canonical := res.Map("canonical") var content Content id := row.Int(cid) revCh := make(chan ContentRevisions) go GetContentRevisions(id, revCh) revisions := <-revCh content = Content{ ID: id, ContentType: row.Str(contentType), PageTitle: row.Str(pageTitle), CreatedDate: row.Time(createdDate, UTC), LastModified: row.Time(lastModified, UTC), MetaTitle: row.Str(metaTitle), MetaDescription: row.Str(metaDesc), Keywords: row.Str(keywords), Primary: row.Bool(isPrimary), Published: row.Bool(published), Active: row.Bool(active), Slug: row.Str(slug), RequireAuth: row.Bool(requireAuth), Canonical: row.Str(canonical), Revisions: revisions, ActiveRevision: revisions.GetActiveRevision(), } ch <- content }
func (l LandingPage) populateLandingPage(row mysql.Row, res mysql.Result, ch chan LandingPage) { page := LandingPage{ ID: row.Int(res.Map("id")), Name: row.Str(res.Map("name")), Start: row.Time(res.Map("startDate"), UTC), End: row.Time(res.Map("endDate"), UTC), URL: row.Str(res.Map("url")), Content: row.Str(res.Map("pageContent")), LinkClasses: row.Str(res.Map("linkClasses")), ConversionID: row.Str(res.Map("conversionID")), ConversionLabel: row.Str(res.Map("conversionLabel")), NewWindow: row.Bool(res.Map("newWindow")), MenuPosition: row.Str(res.Map("menuPosition")), } dch := make(chan []LandingPageData) ich := make(chan LandingPageImages) go page.getImages(ich) go page.getData(dch) page.Images = <-ich page.Data = <-dch ch <- page }
func (p Post) PopulatePost(row mysql.Row, res mysql.Result, ch chan Post) { post := Post{ ID: row.Int(res.Map("blogPostID")), Title: row.Str(res.Map("post_title")), Slug: row.Str(res.Map("slug")), Content: row.Str(res.Map("post_text")), Published: row.Time(res.Map("publishedDate"), UTC), Created: row.Time(res.Map("createdDate"), UTC), LastModified: row.Time(res.Map("lastModified"), UTC), UserID: row.Int(res.Map("userID")), MetaTitle: row.Str(res.Map("meta_title")), MetaDesc: row.Str(res.Map("meta_description")), Keywords: row.Str(res.Map("keywords")), Active: row.Bool(res.Map("active")), } catchan := make(chan BlogCategories) comchan := make(chan Comments) authchan := make(chan User) go func(ch chan User) { author, _ := GetUserByID(post.UserID) ch <- author }(authchan) go func(ch chan Comments) { comments, _ := post.GetComments() ch <- comments }(comchan) go func(ch chan BlogCategories) { categories, _ := post.GetCategories() ch <- categories }(catchan) post.Author = <-authchan post.Categories = <-catchan post.Comments = <-comchan ch <- post }