Skip to content

Commit

Permalink
Fix getting null values from database
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-dharti-r committed Apr 26, 2024
1 parent 0de4967 commit 87e112e
Showing 1 changed file with 6 additions and 8 deletions.
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

0 comments on commit 87e112e

Please sign in to comment.