Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Media ¶
type Media struct { gorm.Model Name string `gorm:"not null" form:"name"` Path string `gorm:"not null;unique" form:"path"` MimeType string `gorm:"not null" form:"mimeType"` Size int64 `gorm:"not null" form:"size"` Description string `gorm:"type:text" form:"description"` File io.Reader `gorm:"-" form:"-"` }
Media represents a media file in the system
func (*Media) BeforeCreate ¶
BeforeCreate hook to ensure media has a mime type
func (*Media) GetHTMLTag ¶
GetHTMLTag returns the HTML tag for the media
func (*Media) GetMarkdownTag ¶
GetMarkdownTag returns the markdown tag for the media
type MediaRepository ¶
type MediaRepository interface { Create(media *Media) error Update(media *Media) error Delete(media *Media) error FindByPath(path string) (*Media, error) FindByID(id uint) (*Media, error) FindByFilename(filename string) (*Media, error) FindAll() ([]*Media, error) SaveAll(media []*Media) error }
MediaRepository defines the interface for media operations
type MenuItem ¶
type MenuItem struct { gorm.Model Label string `gorm:"not null" json:"label" form:"label"` URL *string `gorm:"null" json:"url" form:"url"` // External or internal URL PageID *uint `gorm:"null" json:"pageId" form:"pageId"` // Reference to Page Page *Page `gorm:"foreignKey:PageID" json:"page" form:"page"` Position int `gorm:"not null;default:0" json:"position" form:"position"` }
type MenuItemRepository ¶
type MenuItemRepository interface { Create(item *MenuItem) error CreateAll(items []MenuItem) error Update(item *MenuItem) error Delete(item *MenuItem) error DeleteAll() error FindByID(id uint) (*MenuItem, error) FindAll() ([]*MenuItem, error) UpdatePositions(startPosition int) error GetNextPosition() int Move(id uint, direction string) error }
MenuItemRepository defines the interface for menu item operations
type Page ¶
type Page struct { gorm.Model Title string `gorm:"not null" form:"title"` Slug string `gorm:"uniqueIndex;not null" form:"slug"` Content string `gorm:"not null" form:"content"` ContentType string `gorm:"not null;default:'markdown' " form:"contentType"` // 'markdown' or 'html' Visible bool `gorm:"not null" form:"visible"` }
type PageRepository ¶
type PageRepository interface { Create(page *Page) error Update(page *Page) error Delete(page *Page) error FindByID(id uint) (*Page, error) FindBySlug(slug string) (*Page, error) FindAll() ([]*Page, error) CountRelatedMenuItems(id uint, count *int64) error }
PageRepository defines the interface for page operations
type Post ¶
type Post struct { gorm.Model Title string `gorm:"not null" form:"title"` Slug string `gorm:"uniqueIndex;not null" form:"slug"` Content string `gorm:"not null" form:"content"` PublishedAt time.Time `gorm:"not null"` Visible bool `gorm:"not null" form:"visible"` Excerpt *string `gorm:"type:text" form:"excerpt"` Tags []Tag `gorm:"many2many:post_tags;" form:"tags"` AuthorID uint `gorm:"not null" form:"authorId"` Author *User `gorm:"foreignKey:AuthorID" form:"author"` }
func (*Post) IsScheduled ¶
IsScheduled returns true if the post is scheduled for future publication
type PostRepository ¶
type PostRepository interface { Create(post *Post) error Update(post *Post) error Delete(post *Post) error FindByID(id uint) (*Post, error) FindBySlug(slug string) (*Post, error) FindByTag(tag string) ([]*Post, error) FindAllPaginated(page, perPage int) ([]Post, int64, error) FindVisiblePaginated(page, perPage int, timezone string) ([]Post, int64, error) FindAllByTag(tagID uint, page, perPage int) ([]Post, int64, error) FindVisibleByTag(tagID uint, page, perPage int, timezone string) ([]Post, int64, error) FindAll() ([]*Post, error) FindRecent(limit int) ([]*Post, error) AssociateTags(post *Post, tags []string) error CountByAuthor(user *User) (int64, error) CountByTag(tagID uint) (int64, error) }
PostRepository defines the interface for post operations
type Settings ¶
type Settings struct { gorm.Model Title string `gorm:"not null" form:"title"` Subtitle string `gorm:"not null" form:"subtitle"` Timezone string `gorm:"not null" form:"timezone"` ChromaStyle string `gorm:"not null" form:"chroma_style"` Theme string `gorm:"not null" form:"theme"` PostsPerPage int `gorm:"not null" form:"posts_per_page"` LogoID *uint `gorm:"" form:"logo_id"` UseFavicon bool `gorm:"not null;default:false" form:"use_favicon"` }
Settings represents the site configuration
type SettingsRepository ¶
type SettingsRepository interface { Get() (*Settings, error) Update(settings *Settings) error Create(settings Settings) error }
SettingsRepository defines the interface for settings operations
type Tag ¶
type Tag struct { gorm.Model Name string `gorm:"uniqueIndex;not null" form:"name"` Slug string `gorm:"uniqueIndex;not null" form:"slug"` }
func (*Tag) BeforeCreate ¶
BeforeCreate hook to ensure tag has a slug
type TagRepository ¶
type TagRepository interface { Create(tag *Tag) error Update(tag *Tag) error Delete(tag *Tag) error FindByID(id uint) (*Tag, error) FindBySlug(slug string) (*Tag, error) FindByName(name string) (*Tag, error) FindAll() ([]*Tag, error) FindPostsAndCount() ([]struct { Tag PostCount int64 }, error) }
TagRepository defines the interface for tag operations
type User ¶
type User struct { gorm.Model FirstName string LastName string Email string `gorm:"uniqueIndex"` Password string }
User represents a user in the system
type UserRepository ¶
type UserRepository interface { Create(user *User) error Update(user *User) error Delete(user *User) error FindByID(id uint) (*User, error) FindByEmail(email string) (*User, error) FindAll() ([]*User, error) CountByEmail(email string) (int64, error) CountAll() (int64, error) }
UserRepository defines the interface for user operations