model

package
v0.7.14 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Section

type Section struct {
	ID          int64       `json:"id,omitempty"`
	Slug        string      `json:"slug"`
	SectionType SectionType `json:"section_type"`

	Title    string `json:"title"`
	SubTitle string `json:"sub_title"`
	Short    string `json:"short"`
	Content  string `json:"content"`

	// Metadata for searching and filtering
	Topics   []string `json:"topics"`
	Flags    []string `json:"flags"`
	Commands []string `json:"commands"`

	// Display options
	IsTopLevel     bool `json:"is_top_level"`
	IsTemplate     bool `json:"is_template"`
	ShowPerDefault bool `json:"show_per_default"`
	Order          int  `json:"order"`

	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`

	// Back-reference to the help system (not stored in database)
	// Using interface{} to avoid circular dependency
	HelpSystem interface{} `json:"-" yaml:"_"`
}

Section represents a help section with all its metadata

func (*Section) CommandsAsString

func (s *Section) CommandsAsString() string

CommandsAsString returns commands as a comma-separated string

func (*Section) FlagsAsString

func (s *Section) FlagsAsString() string

FlagsAsString returns flags as a comma-separated string

func (*Section) IsForCommand

func (s *Section) IsForCommand(command string) bool

IsForCommand checks if the section is related to a specific command

func (*Section) IsForFlag

func (s *Section) IsForFlag(flag string) bool

IsForFlag checks if the section is related to a specific flag

func (*Section) IsForTopic

func (s *Section) IsForTopic(topic string) bool

IsForTopic checks if the section is related to a specific topic

func (*Section) SetCommandsFromString

func (s *Section) SetCommandsFromString(commands string)

SetCommandsFromString sets commands from a comma-separated string

func (*Section) SetFlagsFromString

func (s *Section) SetFlagsFromString(flags string)

SetFlagsFromString sets flags from a comma-separated string

func (*Section) SetTopicsFromString

func (s *Section) SetTopicsFromString(topics string)

SetTopicsFromString sets topics from a comma-separated string

func (*Section) TopicsAsString

func (s *Section) TopicsAsString() string

TopicsAsString returns topics as a comma-separated string

func (*Section) Validate

func (s *Section) Validate() error

Validate ensures the section has required fields

type SectionType

type SectionType int

SectionType represents the type of a help section

const (
	SectionGeneralTopic SectionType = iota
	SectionExample
	SectionApplication
	SectionTutorial
)

func SectionTypeFromString

func SectionTypeFromString(s string) (SectionType, error)

SectionTypeFromString converts a string to a SectionType

func (SectionType) String

func (s SectionType) String() string

String returns the string representation of a SectionType

func (SectionType) ToInt

func (s SectionType) ToInt() int

ToInt returns the integer value of a SectionType

Jump to

Keyboard shortcuts

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