repository

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppEntry

type AppEntry struct {
	// Class specifies what class this binding is bound to.
	Class string `json:"class"`

	// Path specifies the file path where the binding is defined.
	Path string `json:"path"`

	// Line indicates the line number in the file where the app entry is declared.
	Line int `json:"line"`
}

AppEntry represents an entry for an application binding in laravel. It holds static information about where a binding is defined in the application

type AppRepository

type AppRepository = Repository[AppEntry]

AppRepository is a type alias for Repository specialized for AppEntry.

type ConfigEntry

type ConfigEntry struct {
	// Value holds the actual value.
	Value any `json:"value"`

	// File specifies the file path where the configuration entry is defined.
	File string `json:"file"`

	// Line indicates the line number in the file where the configuration entry is defined.
	Line int `json:"line"`
}

ConfigEntry holds information for an entry for a single configuration key,value pair in a laravel application.

type ConfigRepository

type ConfigRepository = Repository[ConfigEntry]

ConfigRepository is a type alias for Repository specialized for ConfigEntry.

type Repository

type Repository[T any] map[string]T

Repository is a generic type that maps string keys to values of any type. It essentially acts as a collection for storing and retrieving data by key.

func (*Repository[T]) Clear

func (r *Repository[T]) Clear()

Clear removes all entries from the repository, resetting it to an empty state.

func (Repository[T]) Exists

func (r Repository[T]) Exists(key string) bool

Exists checks if a specific key exists within the repository.

Parameters:

  • key: The key to check for existence.

Returns:

  • A boolean indicating whether the key exists.

func (Repository[T]) Find

func (r Repository[T]) Find(input string) map[string]T

Find searches for entries in the repository whose keys start with the provided prefix. It returns a new map containing only the matching entries.

Parameters:

  • input: The prefix string to match keys against.

Returns:

  • A map of keys and their corresponding values that match the prefix.

func (Repository[T]) Get

func (r Repository[T]) Get(key string) (value T, found bool)

Get retrieves the value associated with the given key.

Parameters:

  • key: The key whose associated value is to be retrieved.

Returns:

  • value: The value corresponding to the key (zero value if not found).
  • found: A boolean indicating whether the key was found in the repository.

Jump to

Keyboard shortcuts

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