models

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PostStatusDraft     = "draft"
	PostStatusPublished = "published"
	PostStatusArchived  = "archived"
)

PostStatus constants

View Source
const (
	CommentStatusApproved = "approved"
	CommentStatusPending  = "pending"
	CommentStatusSpam     = "spam"
)

CommentStatus constants

View Source
const (
	RoleAdmin  = "admin"
	RoleEditor = "editor"
	RoleAuthor = "author"
)

AuthorRole constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Analytics

type Analytics struct {
	UpdatedAt   time.Time      `json:"updated_at"`
	Countries   map[string]int `json:"countries"`
	Referrers   map[string]int `json:"referrers"`
	ID          string         `dynamorm:"pk" json:"id"`
	PostID      string         `json:"post_id"`
	Date        string         `json:"date"`
	Views       int            `json:"views"`
	UniqueViews int            `json:"unique_views"`
}

Analytics represents page view analytics

func (*Analytics) ParseCompositeKey added in v1.0.24

func (a *Analytics) ParseCompositeKey() error

func (*Analytics) SetCompositeKey added in v1.0.24

func (a *Analytics) SetCompositeKey()

Helper methods for Analytics composite key

type Author

type Author struct {
	LastLoginAt time.Time `json:"last_login_at,omitempty"`
	CreatedAt   time.Time `dynamorm:"created_at" json:"created_at"`
	UpdatedAt   time.Time `dynamorm:"updated_at" json:"updated_at"`
	ID          string    `dynamorm:"pk" json:"id"`
	Email       string    `dynamorm:"index:gsi-email,pk" json:"email"`
	Username    string    `dynamorm:"index:gsi-username,pk" json:"username"`
	Name        string    `json:"name"`
	Bio         string    `json:"bio,omitempty"`
	Avatar      string    `json:"avatar,omitempty"`
	Role        string    `json:"role"`
	PostCount   int       `json:"post_count"`
	Active      bool      `json:"active"`
}

Author represents a blog author

type Category

type Category struct {
	CreatedAt   time.Time `dynamorm:"created_at" json:"created_at"`
	UpdatedAt   time.Time `dynamorm:"updated_at" json:"updated_at"`
	ID          string    `dynamorm:"pk" json:"id"`
	Slug        string    `dynamorm:"index:gsi-slug,pk" json:"slug"`
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	ParentID    string    `json:"parent_id,omitempty"`
	PostCount   int       `json:"post_count"`
}

Category represents a blog category

type Comment

type Comment struct {
	CreatedAt   time.Time `dynamorm:"created_at" json:"created_at"`
	UpdatedAt   time.Time `dynamorm:"updated_at" json:"updated_at"`
	ID          string    `dynamorm:"pk" json:"id"`
	PostID      string    `dynamorm:"index:gsi-post,pk" json:"post_id"`
	ParentID    string    `dynamorm:"index:gsi-post,sk,prefix:parent" json:"parent_id,omitempty"`
	AuthorID    string    `json:"author_id"`
	AuthorName  string    `json:"author_name"`
	AuthorEmail string    `json:"author_email"`
	Content     string    `json:"content"`
	Status      string    `json:"status"`
	IPAddress   string    `json:"ip_address,omitempty"`
	UserAgent   string    `json:"user_agent,omitempty"`
}

Comment represents a comment on a post

type ContentBlock

type ContentBlock struct {
	CreatedAt time.Time         `dynamorm:"created_at" json:"created_at"`
	UpdatedAt time.Time         `dynamorm:"updated_at" json:"updated_at"`
	Variables map[string]string `dynamorm:"json" json:"variables,omitempty"`
	ID        string            `dynamorm:"pk" json:"id"`
	Name      string            `dynamorm:"index:gsi-name,unique" json:"name"`
	Type      string            `json:"type"`
	Content   string            `json:"content"`
	Version   int               `dynamorm:"version" json:"version"`
}

ContentBlock represents reusable content blocks

type EmailTemplate added in v1.0.24

type EmailTemplate struct {
	CreatedAt time.Time         `dynamorm:"created_at" json:"created_at"`
	UpdatedAt time.Time         `dynamorm:"updated_at" json:"updated_at"`
	Metadata  map[string]string `json:"metadata,omitempty"`
	ID        string            `dynamorm:"pk" json:"id"`
	Name      string            `dynamorm:"index:gsi-name,pk" json:"name"`
	Subject   string            `json:"subject"`
	Body      string            `json:"body"`
	Type      string            `json:"type"`
	Variables []string          `json:"variables"`
	Active    bool              `json:"active"`
}

EmailTemplate represents an email template

type Page added in v1.0.24

type Page struct {
	PublishedAt time.Time         `json:"published_at,omitempty"`
	UpdatedAt   time.Time         `dynamorm:"updated_at" json:"updated_at"`
	CreatedAt   time.Time         `dynamorm:"created_at" json:"created_at"`
	Metadata    map[string]string `json:"metadata,omitempty"`
	SEO         SEOMetadata       `json:"seo,omitempty"`
	Title       string            `json:"title"`
	Status      string            `json:"status"`
	Template    string            `json:"template,omitempty"`
	Content     string            `json:"content"`
	ID          string            `dynamorm:"pk" json:"id"`
	ParentID    string            `json:"parent_id,omitempty"`
	Slug        string            `dynamorm:"index:gsi-slug,pk" json:"slug"`
	Order       int               `json:"order"`
	Version     int               `dynamorm:"version" json:"version"`
}

Page represents a static page

type Post

type Post struct {
	PublishedAt   time.Time         `dynamorm:"index:gsi-status-date,sk" json:"published_at,omitempty"`
	UpdatedAt     time.Time         `dynamorm:"updated_at" json:"updated_at"`
	CreatedAt     time.Time         `dynamorm:"created_at" json:"created_at"`
	Metadata      map[string]string `json:"metadata,omitempty"`
	SEO           SEOMetadata       `json:"seo,omitempty"`
	Content       string            `json:"content"`
	Status        string            `dynamorm:"index:gsi-status-date,pk" json:"status"`
	Excerpt       string            `json:"excerpt,omitempty"`
	CategoryID    string            `dynamorm:"index:gsi-category,pk" json:"category_id,omitempty"`
	ID            string            `dynamorm:"pk" json:"id"`
	FeaturedImage string            `json:"featured_image,omitempty"`
	Title         string            `json:"title"`
	AuthorID      string            `dynamorm:"index:gsi-author,pk" json:"author_id"`
	Slug          string            `dynamorm:"index:gsi-slug,pk" json:"slug"`
	Tags          []string          `dynamorm:"set" json:"tags,omitempty"`
	ViewCount     int               `json:"view_count"`
	CommentCount  int               `json:"comment_count"`
	Version       int               `dynamorm:"version" json:"version"`
}

Post represents a blog post

type PostView

type PostView struct {
	Timestamp time.Time `json:"timestamp"`
	TTL       time.Time `dynamorm:"ttl" json:"ttl"`
	ID        string    `dynamorm:"pk" json:"id"`
	PostID    string    `json:"post_id"`
	SessionID string    `json:"session_id"`
	Country   string    `json:"country,omitempty"`
	Referrer  string    `json:"referrer,omitempty"`
}

PostView tracks individual post views for analytics

func (*PostView) ParseCompositeKey added in v1.0.24

func (p *PostView) ParseCompositeKey() error

func (*PostView) SetCompositeKey added in v1.0.24

func (p *PostView) SetCompositeKey()

Helper methods for PostView composite key

type RelatedPost

type RelatedPost struct {
	CreatedAt time.Time `json:"created_at"`
	ID        string    `dynamorm:"pk,composite:post_id,related_id" json:"id"`
	PostID    string    `dynamorm:"extract:post_id" json:"post_id"`
	RelatedID string    `dynamorm:"extract:related_id" json:"related_id"`
	Score     float64   `json:"score"`
}

RelatedPost represents a many-to-many relationship between posts

type SEOMetadata added in v1.0.24

type SEOMetadata struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Keywords    string `json:"keywords,omitempty"`
	OGImage     string `json:"og_image,omitempty"`
}

SEOMetadata represents SEO information for posts and pages

type SearchIndex

type SearchIndex struct {
	UpdatedAt   time.Time `json:"updated_at"`
	ID          string    `dynamorm:"pk" json:"id"`
	ContentType string    `dynamorm:"index:gsi-search,pk" json:"content_type"`
	SearchTerms string    `dynamorm:"index:gsi-search,sk" json:"search_terms"`
	PostID      string    `json:"post_id"`
	Title       string    `json:"title"`
	Excerpt     string    `json:"excerpt"`
	Tags        []string  `dynamorm:"set" json:"tags"`
}

SearchIndex represents a search index entry for full-text search

type Session

type Session struct {
	CreatedAt   time.Time `json:"created_at"`
	ExpiresAt   time.Time `dynamorm:"ttl" json:"expires_at"`
	ID          string    `dynamorm:"pk" json:"id"`
	IPAddress   string    `json:"ip_address"`
	UserAgent   string    `json:"user_agent"`
	PostsViewed []string  `dynamorm:"set" json:"posts_viewed"`
}

Session represents a user session for tracking unique views

type Subscriber

type Subscriber struct {
	VerifiedAt       time.Time `json:"verified_at,omitempty"`
	CreatedAt        time.Time `dynamorm:"created_at" json:"created_at"`
	UpdatedAt        time.Time `dynamorm:"updated_at" json:"updated_at"`
	ID               string    `dynamorm:"pk" json:"id"`
	Email            string    `dynamorm:"index:gsi-email,pk" json:"email"`
	Name             string    `json:"name,omitempty"`
	Status           string    `json:"status"`
	UnsubscribeToken string    `json:"-"`
	Categories       []string  `dynamorm:"set" json:"categories,omitempty"`
	Tags             []string  `dynamorm:"set" json:"tags,omitempty"`
}

Subscriber represents an email subscriber

type Tag

type Tag struct {
	CreatedAt time.Time `dynamorm:"created_at" json:"created_at"`
	ID        string    `dynamorm:"pk" json:"id"`
	Name      string    `dynamorm:"index:gsi-name,pk" json:"name"`
	Slug      string    `dynamorm:"index:gsi-slug,pk" json:"slug"`
	PostCount int       `json:"post_count"`
}

Tag represents a blog tag

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL