Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry[K GroupName, T any] struct { // FileData is the full contents of the file that contain this entry FileData []byte Beg, End uint32 // MStmt is statement about membership MStmt *MStmt[K, T] // Comment is a line that starts with # Comment *string // Include is a line that starts with !include // The rest of the line is interpretted as a paths to include Include *string }
Entry is a single line in a GroupFile K is the name for a group
func Parse ¶
func Parse[K GroupName, T any](data []byte, parseK func([]byte) (K, error), parseV func([]byte) (T, error)) (ret []Entry[K, T], _ error)
Parse parses a groupfile from data, which should be the entire contents of a group file.
func (*Entry[K, T]) Memberships ¶
func (ent *Entry[K, T]) Memberships() (ret []Membership[K, T])
Memberships returns all Memberships contained in the entry.
type ErrParsing ¶
func (ErrParsing) Error ¶
func (e ErrParsing) Error() string
type GroupName ¶
type GroupName interface {
comparable
String() string
}
GroupName is implemented by all types that can be the name of a group. GroupNames must be comparable and implement the String method
type Member ¶
type Member[K GroupName, T any] struct { // Unit references a single element Unit *T // GroupRef references another group by name. GroupRef *K // Empty is used to create empty groups. Empty *struct{} }
Member is a member of a group. Members can either refer to another group by name, or to a single element of type T.
type Membership ¶
Membership says that a group contains a member.
Click to show internal directories.
Click to hide internal directories.