Documentation ¶
Overview ¶
Package randomizer implements the randomizer's core logic in a manner suitable for use by multiple frontends.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents a randomizer app that can accept commands.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents an error encountered by the randomizer. It includes friendly help messages that can be displayed directly to users when errors occur, along with an underlying developer-friendly error that may be useful for debugging.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result represents a successful randomizer operation.
type ResultType ¶
type ResultType int
ResultType represents the type of successful result returned by the randomizer.
const ( // Selection indicates that the randomizer made a random selection from input // options. Selection ResultType = iota // ShowedHelp indicates that the randomizer displayed its help output. ShowedHelp // ListedGroups indicates that a group list was successfully obtained. ListedGroups // ShowedGroup indicates that the options of a single group were successfully obtained. ShowedGroup // SavedGroup indicates that a group was successfully saved. SavedGroup // DeletedGroup indicates that a group was successfully deleted. DeletedGroup )
type Store ¶
type Store interface { // List returns the names of all available groups. If no groups have been // saved, it returns an empty list with a nil error. List(ctx context.Context) (groups []string, err error) // Get returns the list of options in the named group. If the group does not // exist, it returns an empty list with a nil error. Get(ctx context.Context, group string) (options []string, err error) // Put saves the provided options as a named group, overwriting any previous // group with that name. Put(ctx context.Context, group string, options []string) error // Delete ensures that the named group no longer exists, returning true or // false to indicate whether the group existed prior to this deletion // attempt. Delete(ctx context.Context, group string) (bool, error) }
Store represents an object that provides persistence for "groups" of options.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.