Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Getting some null values from database for blog #576

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions post/models.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package post

import (
"time"

"github.com/jmoiron/sqlx"
"gopkg.in/guregu/null.v3"
)
Expand All @@ -14,17 +12,17 @@ type Repository struct {
type Post struct {
Id int `json:"id"`
Title string `json:"title"`
Content string `json:"content,omitempty"`
Content null.String `json:"content,omitempty"`
Slug string `json:"slug"`
PublishedOn time.Time `json:"published_on,omitempty"`
PublishedOn null.String `json:"published_on,omitempty"`
IsFeatured bool `json:"is_featured"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
PublishedAt null.String `json:"published_at"`
Summary string `json:"summary,omitempty"`
BlogContent string `json:"blog_content,omitempty"`
MetaDescription string `json:"meta_description,omitempty"`
Toc string `json:"toc,omitempty"`
Toc null.String `json:"toc,omitempty"`
Tag string `json:"tag,omitempty"`
Tags []Tag `json:"tags,omitempty"`
IsPublished bool `json:"is_published"`
Expand Down Expand Up @@ -113,17 +111,17 @@ type Cta struct {
type RecommendedPost struct {
Id int `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Content null.String `json:"content"`
Slug string `json:"slug"`
PublishedOn time.Time `json:"published_on"`
PublishedOn null.String `json:"published_on"`
IsFeatured bool `json:"is_featured"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
PublishedAt null.String `json:"published_at"`
Summary string `json:"summary"`
BlogContent string `json:"blog_content"`
MetaDescription string `json:"meta_description"`
Toc string `json:"toc"`
Toc null.String `json:"toc"`
Tag string `json:"tag,omitempty"`
Tags []Tag `json:"tags"`
IsPublished bool `json:"is_published"`
Expand Down
Loading