Documentation
¶
Overview ¶
Package lenses provides pre-built lens and prism implementations for common data structures.
This package offers ready-to-use optics (lenses and prisms) for working with regex match structures and URL components in a functional programming style. Lenses enable immutable updates to nested data structures, while prisms provide safe optional access to fields.
Overview ¶
The package includes optics for:
- Match structures: For working with regex match results (indexed capture groups)
- NamedMatch structures: For working with regex matches with named capture groups
- url.Userinfo: For working with URL authentication information
Each structure has three variants of optics:
- Value lenses: Work with value types (immutable updates)
- Reference lenses: Work with pointer types (mutable updates)
- Prisms: Provide optional access treating zero values as None
Lenses vs Prisms ¶
Lenses provide guaranteed access to a field within a structure:
- Get: Extract a field value
- Set: Update a field value (returns new structure for values, mutates for pointers)
Prisms provide optional access to fields that may not be present:
- GetOption: Try to extract a field, returning Option[T]
- ReverseGet: Construct a structure from a field value
Match Structures ¶
Match represents a regex match with indexed capture groups:
type Match struct {
Before string // Text before the match
Groups []string // Capture groups (index 0 is full match)
After string // Text after the match
}
NamedMatch represents a regex match with named capture groups:
type NamedMatch struct {
Before string // Text before the match
Groups map[string]string // Named capture groups
Full string // Full matched text
After string // Text after the match
}
Usage Examples ¶
Working with Match (value-based):
lenses := MakeMatchLenses()
match := Match{
Before: "Hello ",
Groups: []string{"world", "world"},
After: "!",
}
// Get a field
before := lenses.Before.Get(match) // "Hello "
// Update a field (returns new Match)
updated := lenses.Before.Set(match, "Hi ")
// updated.Before is "Hi ", original match unchanged
// Use optional lens (treats empty string as None)
emptyMatch := Match{Before: "", Groups: []string{}, After: ""}
beforeOpt := lenses.BeforeO.GetOption(emptyMatch) // None
Working with Match (reference-based):
lenses := MakeMatchRefLenses()
match := &Match{
Before: "Hello ",
Groups: []string{"world"},
After: "!",
}
// Get a field
before := lenses.Before.Get(match) // "Hello "
// Update a field (mutates the pointer)
lenses.Before.Set(match, "Hi ")
// match.Before is now "Hi "
// Use prism for optional access
afterOpt := lenses.AfterP.GetOption(match) // Some("!")
Working with NamedMatch:
lenses := MakeNamedMatchLenses()
match := NamedMatch{
Before: "Email: ",
Groups: map[string]string{
"user": "john",
"domain": "example.com",
},
Full: "john@example.com",
After: "",
}
// Get field values
full := lenses.Full.Get(match) // "john@example.com"
groups := lenses.Groups.Get(match) // map with user and domain
// Update a field
updated := lenses.Before.Set(match, "Contact: ")
// Use optional lens
afterOpt := lenses.AfterO.GetOption(match) // None (empty string)
Working with url.Userinfo:
lenses := MakeUserinfoRefLenses()
userinfo := url.UserPassword("john", "secret123")
// Get username
username := lenses.Username.Get(userinfo) // "john"
// Update password (returns new Userinfo)
updated := lenses.Password.Set(userinfo, "newpass")
// Use optional lens for password
pwdOpt := lenses.PasswordO.GetOption(userinfo) // Some("secret123")
// Handle userinfo without password
userOnly := url.User("alice")
Working with url.URL:
lenses := MakeURLLenses()
u := url.URL{
Scheme: "https",
Host: "example.com",
Path: "/api/v1/users",
}
// Get field values
scheme := lenses.Scheme.Get(u) // "https"
host := lenses.Host.Get(u) // "example.com"
// Update fields (returns new URL)
updated := lenses.Path.Set("/api/v2/users")(u)
// updated.Path is "/api/v2/users", original u unchanged
// Use optional lens for query string
queryOpt := lenses.RawQueryO.Get(u) // None (no query string)
// Set query string
withQuery := lenses.RawQuery.Set("page=1&limit=10")(u)
Working with url.Error:
lenses := MakeErrorLenses()
urlErr := url.Error{
Op: "Get",
URL: "https://example.com",
Err: errors.New("connection timeout"),
}
// Get field values
op := lenses.Op.Get(urlErr) // "Get"
urlStr := lenses.URL.Get(urlErr) // "https://example.com"
err := lenses.Err.Get(urlErr) // error: "connection timeout"
// Update fields (returns new Error)
updated := lenses.Op.Set("Post")(urlErr)
// updated.Op is "Post", original urlErr unchanged
pwdOpt = lenses.PasswordO.GetOption(userOnly) // None
Composing Optics ¶
Lenses and prisms can be composed to access nested structures:
// Compose lenses to access nested fields outerLens := MakeSomeLens() innerLens := MakeSomeOtherLens() composed := lens.Compose(outerLens, innerLens) // Compose prisms for optional nested access outerPrism := MakeSomePrism() innerPrism := MakeSomeOtherPrism() composed := prism.Compose(outerPrism, innerPrism)
Optional Lenses ¶
Optional lenses (suffixed with 'O') treat zero values as None:
- Empty strings become None
- Zero values of other types become None
- Non-zero values become Some(value)
This is useful for distinguishing between "field not set" and "field set to zero value":
lenses := MakeMatchLenses()
match := Match{Before: "", Groups: []string{"test"}, After: "!"}
// Regular lens returns empty string
before := lenses.Before.Get(match) // ""
// Optional lens returns None
beforeOpt := lenses.BeforeO.GetOption(match) // None
// Setting None clears the field
cleared := lenses.BeforeO.Set(match, option.None[string]())
// cleared.Before is ""
// Setting Some updates the field
updated := lenses.BeforeO.Set(match, option.Some("prefix "))
// updated.Before is "prefix "
Code Generation ¶
This package uses code generation for creating lens implementations. The generate directive at the top of this file triggers the lens generator:
//go:generate go run ../../main.go lens --dir . --filename gen_lens.go
To regenerate lenses after modifying structures, run:
go generate ./optics/lenses
Performance Considerations ¶
Value-based lenses (MatchLenses, NamedMatchLenses):
- Create new structures on each Set operation
- Safe for concurrent use (immutable)
- Suitable for functional programming patterns
Reference-based lenses (MatchRefLenses, NamedMatchRefLenses):
- Mutate existing structures
- More efficient for repeated updates
- Require careful handling in concurrent contexts
Related Packages ¶
- github.com/IBM/fp-go/v2/optics/lens: Core lens functionality
- github.com/IBM/fp-go/v2/optics/prism: Core prism functionality
- github.com/IBM/fp-go/v2/optics/iso: Isomorphisms for type conversions
- github.com/IBM/fp-go/v2/option: Option type for optional values
See Also ¶
For more information on functional optics:
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorLenses ¶
type ErrorLenses struct {
// mandatory fields
Op __lens.Lens[url.Error, string]
URL __lens.Lens[url.Error, string]
Err __lens.Lens[url.Error, error]
// optional fields
OpO __lens_option.LensO[url.Error, string]
URLO __lens_option.LensO[url.Error, string]
ErrO __lens_option.LensO[url.Error, error]
}
ErrorLenses provides lenses for accessing fields of url.Error
func MakeErrorLenses ¶
func MakeErrorLenses() ErrorLenses
MakeErrorLenses creates a new ErrorLenses with lenses for all fields
type ErrorRefLenses ¶
type ErrorRefLenses struct {
// mandatory fields
Op __lens.Lens[*url.Error, string]
URL __lens.Lens[*url.Error, string]
Err __lens.Lens[*url.Error, error]
// optional fields
OpO __lens_option.LensO[*url.Error, string]
URLO __lens_option.LensO[*url.Error, string]
ErrO __lens_option.LensO[*url.Error, error]
}
ErrorRefLenses provides lenses for accessing fields of url.Error via a reference to url.Error
func MakeErrorRefLenses ¶
func MakeErrorRefLenses() ErrorRefLenses
MakeErrorRefLenses creates a new ErrorRefLenses with lenses for all fields
type MatchLenses ¶
type MatchLenses struct {
// mandatory fields
Before __lens.Lens[__prism.Match, string]
Groups __lens.Lens[__prism.Match, []string]
After __lens.Lens[__prism.Match, string]
// optional fields
BeforeO __lens_option.LensO[__prism.Match, string]
AfterO __lens_option.LensO[__prism.Match, string]
}
MatchLenses provides lenses for accessing and modifying fields of Match structures. Lenses enable functional updates to immutable data structures by providing composable getters and setters.
This struct contains both mandatory lenses (for direct field access) and optional lenses (for fields that may be zero values, treating them as Option types).
Fields:
- Before: Lens for the text before the match
- Groups: Lens for the capture groups array
- After: Lens for the text after the match
- BeforeO: Optional lens treating empty Before as None
- AfterO: Optional lens treating empty After as None
Example:
lenses := MakeMatchLenses()
match := Match{Before: "hello ", Groups: []string{"world"}, After: "!"}
// Get a field value
before := lenses.Before.Get(match) // "hello "
// Set a field value (returns new Match)
updated := lenses.Before.Set(match, "hi ")
// updated.Before is now "hi "
func MakeMatchLenses ¶
func MakeMatchLenses() MatchLenses
MakeMatchLenses creates a new MatchLenses with lenses for all fields of Match. This function constructs both mandatory lenses (for direct field access) and optional lenses (for treating zero values as Option types).
The returned lenses enable functional-style updates to Match structures, allowing you to get and set field values while maintaining immutability.
Returns:
- A MatchLenses struct with lenses for Before, Groups, After fields, plus optional lenses BeforeO and AfterO
Example:
lenses := MakeMatchLenses()
match := Match{Before: "start ", Groups: []string{"middle"}, After: " end"}
// Get field values
before := lenses.Before.Get(match) // "start "
groups := lenses.Groups.Get(match) // []string{"middle"}
// Update a field (returns new Match)
updated := lenses.After.Set(match, " finish")
// updated is a new Match with After = " finish"
// Use optional lens (treats empty string as None)
emptyMatch := Match{Before: "", Groups: []string{}, After: ""}
beforeOpt := lenses.BeforeO.GetOption(emptyMatch) // None
type MatchPrisms ¶
type MatchPrisms struct {
Before __prism.Prism[__prism.Match, string]
Groups __prism.Prism[__prism.Match, []string]
After __prism.Prism[__prism.Match, string]
}
MatchPrisms provides prisms for accessing fields of Match structures. Prisms enable safe access to fields that may not be present (zero values), returning Option types instead of direct values.
Fields:
- Before: Prism for Before field (None if empty string)
- Groups: Prism for Groups field (always Some)
- After: Prism for After field (None if empty string)
Example:
prisms := MakeMatchPrisms()
match := Match{Before: "", Groups: []string{"test"}, After: "!"}
// Try to get Before (returns None because it's empty)
beforeOpt := prisms.Before.GetOption(match) // None
// Get After (returns Some because it's non-empty)
afterOpt := prisms.After.GetOption(match) // Some("!")
func MakeMatchPrisms ¶
func MakeMatchPrisms() MatchPrisms
MakeMatchPrisms creates a new MatchPrisms with prisms for all fields of Match. This function constructs prisms that provide safe optional access to Match fields, treating zero values (empty strings) as None.
The returned prisms enable pattern matching on field presence:
- Before and After prisms return None for empty strings
- Groups prism always returns Some (even for empty slices)
Returns:
- A MatchPrisms struct with prisms for Before, Groups, and After fields
Example:
prisms := MakeMatchPrisms()
match := Match{Before: "", Groups: []string{"data"}, After: "!"}
// Try to get Before (returns None because it's empty)
beforeOpt := prisms.Before.GetOption(match) // None
// Get Groups (always returns Some)
groupsOpt := prisms.Groups.GetOption(match) // Some([]string{"data"})
// Get After (returns Some because it's non-empty)
afterOpt := prisms.After.GetOption(match) // Some("!")
// Construct a Match from a value using ReverseGet
newMatch := prisms.Before.ReverseGet("prefix ")
// newMatch is Match{Before: "prefix ", Groups: nil, After: ""}
type MatchRefLenses ¶
type MatchRefLenses struct {
// mandatory fields
Before __lens.Lens[*__prism.Match, string]
Groups __lens.Lens[*__prism.Match, []string]
After __lens.Lens[*__prism.Match, string]
// optional fields
BeforeO __lens_option.LensO[*__prism.Match, string]
AfterO __lens_option.LensO[*__prism.Match, string]
// prisms
BeforeP __prism.Prism[*__prism.Match, string]
GroupsP __prism.Prism[*__prism.Match, []string]
AfterP __prism.Prism[*__prism.Match, string]
}
MatchRefLenses provides lenses for accessing and modifying fields of Match structures via pointers. This is useful when working with mutable references to Match values.
In addition to standard lenses, this struct also includes prisms for each field, which provide optional access patterns (useful for validation or conditional updates).
Fields:
- Before, Groups, After: Standard lenses for pointer-based access
- BeforeO, AfterO: Optional lenses treating zero values as None
- BeforeP, GroupsP, AfterP: Prisms for optional field access
Example:
lenses := MakeMatchRefLenses()
match := &Match{Before: "hello ", Groups: []string{"world"}, After: "!"}
// Get a field value
before := lenses.Before.Get(match) // "hello "
// Set a field value (mutates the pointer)
lenses.Before.Set(match, "hi ")
// match.Before is now "hi "
func MakeMatchRefLenses ¶
func MakeMatchRefLenses() MatchRefLenses
MakeMatchRefLenses creates a new MatchRefLenses with lenses for all fields of *Match. This function constructs lenses that work with pointers to Match structures, enabling both immutable-style updates and direct mutations.
The returned lenses include:
- Standard lenses for pointer-based field access
- Optional lenses for treating zero values as Option types
- Prisms for safe optional field access
Returns:
- A MatchRefLenses struct with lenses and prisms for all Match fields
Example:
lenses := MakeMatchRefLenses()
match := &Match{Before: "prefix ", Groups: []string{"data"}, After: " suffix"}
// Get field value
before := lenses.Before.Get(match) // "prefix "
// Set field value (mutates the pointer)
lenses.Before.Set(match, "new ")
// match.Before is now "new "
// Use prism for optional access
afterOpt := lenses.AfterP.GetOption(match) // Some(" suffix")
type NamedMatchLenses ¶
type NamedMatchLenses struct {
// mandatory fields
Before __lens.Lens[__prism.NamedMatch, string]
Groups __lens.Lens[__prism.NamedMatch, map[string]string]
Full __lens.Lens[__prism.NamedMatch, string]
After __lens.Lens[__prism.NamedMatch, string]
// optional fields
BeforeO __lens_option.LensO[__prism.NamedMatch, string]
FullO __lens_option.LensO[__prism.NamedMatch, string]
AfterO __lens_option.LensO[__prism.NamedMatch, string]
}
NamedMatchLenses provides lenses for accessing and modifying fields of NamedMatch structures. NamedMatch represents regex matches with named capture groups, and these lenses enable functional updates to its fields.
This struct contains both mandatory lenses (for direct field access) and optional lenses (for fields that may be zero values, treating them as Option types).
Fields:
- Before: Lens for the text before the match
- Groups: Lens for the named capture groups map
- Full: Lens for the complete matched text
- After: Lens for the text after the match
- BeforeO, FullO, AfterO: Optional lenses treating empty strings as None
Example:
lenses := MakeNamedMatchLenses()
match := NamedMatch{
Before: "Email: ",
Groups: map[string]string{"user": "john", "domain": "example.com"},
Full: "john@example.com",
After: "",
}
// Get a field value
full := lenses.Full.Get(match) // "john@example.com"
// Set a field value (returns new NamedMatch)
updated := lenses.Before.Set(match, "Contact: ")
// updated.Before is now "Contact: "
func MakeNamedMatchLenses ¶
func MakeNamedMatchLenses() NamedMatchLenses
MakeNamedMatchLenses creates a new NamedMatchLenses with lenses for all fields of NamedMatch. This function constructs both mandatory lenses (for direct field access) and optional lenses (for treating zero values as Option types).
The returned lenses enable functional-style updates to NamedMatch structures, allowing you to get and set field values while maintaining immutability.
Returns:
- A NamedMatchLenses struct with lenses for Before, Groups, Full, After fields, plus optional lenses BeforeO, FullO, and AfterO
Example:
lenses := MakeNamedMatchLenses()
match := NamedMatch{
Before: "Email: ",
Groups: map[string]string{"user": "john", "domain": "example.com"},
Full: "john@example.com",
After: "",
}
// Get field values
full := lenses.Full.Get(match) // "john@example.com"
groups := lenses.Groups.Get(match) // map[string]string{"user": "john", ...}
// Update a field (returns new NamedMatch)
updated := lenses.Before.Set(match, "Contact: ")
// updated is a new NamedMatch with Before = "Contact: "
// Use optional lens (treats empty string as None)
afterOpt := lenses.AfterO.GetOption(match) // None (because After is empty)
type NamedMatchPrisms ¶
type NamedMatchPrisms struct {
Before __prism.Prism[__prism.NamedMatch, string]
Groups __prism.Prism[__prism.NamedMatch, map[string]string]
Full __prism.Prism[__prism.NamedMatch, string]
After __prism.Prism[__prism.NamedMatch, string]
}
NamedMatchPrisms provides prisms for accessing fields of NamedMatch structures. Prisms enable safe access to fields that may not be present (zero values), returning Option types instead of direct values.
Fields:
- Before: Prism for Before field (None if empty string)
- Groups: Prism for Groups field (always Some)
- Full: Prism for Full field (None if empty string)
- After: Prism for After field (None if empty string)
Example:
prisms := MakeNamedMatchPrisms()
match := NamedMatch{
Before: "",
Groups: map[string]string{"user": "bob"},
Full: "bob@example.com",
After: "",
}
// Try to get Before (returns None because it's empty)
beforeOpt := prisms.Before.GetOption(match) // None
// Get Full (returns Some because it's non-empty)
fullOpt := prisms.Full.GetOption(match) // Some("bob@example.com")
func MakeNamedMatchPrisms ¶
func MakeNamedMatchPrisms() NamedMatchPrisms
MakeNamedMatchPrisms creates a new NamedMatchPrisms with prisms for all fields of NamedMatch. This function constructs prisms that provide safe optional access to NamedMatch fields, treating zero values (empty strings) as None.
The returned prisms enable pattern matching on field presence:
- Before, Full, and After prisms return None for empty strings
- Groups prism always returns Some (even for nil or empty maps)
Returns:
- A NamedMatchPrisms struct with prisms for Before, Groups, Full, and After fields
Example:
prisms := MakeNamedMatchPrisms()
match := NamedMatch{
Before: "",
Groups: map[string]string{"user": "bob", "domain": "example.com"},
Full: "bob@example.com",
After: "",
}
// Try to get Before (returns None because it's empty)
beforeOpt := prisms.Before.GetOption(match) // None
// Get Groups (always returns Some)
groupsOpt := prisms.Groups.GetOption(match)
// Some(map[string]string{"user": "bob", "domain": "example.com"})
// Get Full (returns Some because it's non-empty)
fullOpt := prisms.Full.GetOption(match) // Some("bob@example.com")
// Construct a NamedMatch from a value using ReverseGet
newMatch := prisms.Full.ReverseGet("test@example.com")
// newMatch is NamedMatch{Before: "", Groups: nil, Full: "test@example.com", After: ""}
type NamedMatchRefLenses ¶
type NamedMatchRefLenses struct {
// mandatory fields
Before __lens.Lens[*__prism.NamedMatch, string]
Groups __lens.Lens[*__prism.NamedMatch, map[string]string]
Full __lens.Lens[*__prism.NamedMatch, string]
After __lens.Lens[*__prism.NamedMatch, string]
// optional fields
BeforeO __lens_option.LensO[*__prism.NamedMatch, string]
FullO __lens_option.LensO[*__prism.NamedMatch, string]
AfterO __lens_option.LensO[*__prism.NamedMatch, string]
// prisms
BeforeP __prism.Prism[*__prism.NamedMatch, string]
GroupsP __prism.Prism[*__prism.NamedMatch, map[string]string]
FullP __prism.Prism[*__prism.NamedMatch, string]
AfterP __prism.Prism[*__prism.NamedMatch, string]
}
NamedMatchRefLenses provides lenses for accessing and modifying fields of NamedMatch structures via pointers. This is useful when working with mutable references to NamedMatch values.
In addition to standard lenses, this struct also includes prisms for each field, which provide optional access patterns (useful for validation or conditional updates).
Fields:
- Before, Groups, Full, After: Standard lenses for pointer-based access
- BeforeO, FullO, AfterO: Optional lenses treating zero values as None
- BeforeP, GroupsP, FullP, AfterP: Prisms for optional field access
Example:
lenses := MakeNamedMatchRefLenses()
match := &NamedMatch{
Before: "Email: ",
Groups: map[string]string{"user": "alice", "domain": "test.org"},
Full: "alice@test.org",
After: " for info",
}
// Get a field value
full := lenses.Full.Get(match) // "alice@test.org"
// Set a field value (mutates the pointer)
lenses.After.Set(match, " for contact")
// match.After is now " for contact"
func MakeNamedMatchRefLenses ¶
func MakeNamedMatchRefLenses() NamedMatchRefLenses
MakeNamedMatchRefLenses creates a new NamedMatchRefLenses with lenses for all fields of *NamedMatch. This function constructs lenses that work with pointers to NamedMatch structures, enabling both immutable-style updates and direct mutations.
The returned lenses include:
- Standard lenses for pointer-based field access
- Optional lenses for treating zero values as Option types
- Prisms for safe optional field access
Returns:
- A NamedMatchRefLenses struct with lenses and prisms for all NamedMatch fields
Example:
lenses := MakeNamedMatchRefLenses()
match := &NamedMatch{
Before: "Email: ",
Groups: map[string]string{"user": "alice", "domain": "test.org"},
Full: "alice@test.org",
After: "",
}
// Get field value
full := lenses.Full.Get(match) // "alice@test.org"
// Set field value (mutates the pointer)
lenses.Before.Set(match, "Contact: ")
// match.Before is now "Contact: "
// Use prism for optional access
fullOpt := lenses.FullP.GetOption(match) // Some("alice@test.org")
type URLLenses ¶
type URLLenses struct {
// mandatory fields
Scheme __lens.Lens[url.URL, string]
Opaque __lens.Lens[url.URL, string]
User __lens.Lens[url.URL, *url.Userinfo]
Host __lens.Lens[url.URL, string]
Path __lens.Lens[url.URL, string]
RawPath __lens.Lens[url.URL, string]
OmitHost __lens.Lens[url.URL, bool]
ForceQuery __lens.Lens[url.URL, bool]
RawQuery __lens.Lens[url.URL, string]
Fragment __lens.Lens[url.URL, string]
RawFragment __lens.Lens[url.URL, string]
// optional fields
SchemeO __lens_option.LensO[url.URL, string]
OpaqueO __lens_option.LensO[url.URL, string]
UserO __lens_option.LensO[url.URL, *url.Userinfo]
HostO __lens_option.LensO[url.URL, string]
PathO __lens_option.LensO[url.URL, string]
RawPathO __lens_option.LensO[url.URL, string]
OmitHostO __lens_option.LensO[url.URL, bool]
ForceQueryO __lens_option.LensO[url.URL, bool]
RawQueryO __lens_option.LensO[url.URL, string]
FragmentO __lens_option.LensO[url.URL, string]
RawFragmentO __lens_option.LensO[url.URL, string]
}
URLLenses provides lenses for accessing fields of url.URL
func MakeURLLenses ¶
func MakeURLLenses() URLLenses
MakeURLLenses creates a new URLLenses with lenses for all fields
type URLRefLenses ¶
type URLRefLenses struct {
// mandatory fields
Scheme __lens.Lens[*url.URL, string]
Opaque __lens.Lens[*url.URL, string]
User __lens.Lens[*url.URL, *url.Userinfo]
Host __lens.Lens[*url.URL, string]
Path __lens.Lens[*url.URL, string]
RawPath __lens.Lens[*url.URL, string]
OmitHost __lens.Lens[*url.URL, bool]
ForceQuery __lens.Lens[*url.URL, bool]
RawQuery __lens.Lens[*url.URL, string]
Fragment __lens.Lens[*url.URL, string]
RawFragment __lens.Lens[*url.URL, string]
// optional fields
SchemeO __lens_option.LensO[*url.URL, string]
OpaqueO __lens_option.LensO[*url.URL, string]
UserO __lens_option.LensO[*url.URL, *url.Userinfo]
HostO __lens_option.LensO[*url.URL, string]
PathO __lens_option.LensO[*url.URL, string]
RawPathO __lens_option.LensO[*url.URL, string]
OmitHostO __lens_option.LensO[*url.URL, bool]
ForceQueryO __lens_option.LensO[*url.URL, bool]
RawQueryO __lens_option.LensO[*url.URL, string]
FragmentO __lens_option.LensO[*url.URL, string]
RawFragmentO __lens_option.LensO[*url.URL, string]
}
URLRefLenses provides lenses for accessing fields of url.URL via a reference to url.URL
func MakeURLRefLenses ¶
func MakeURLRefLenses() URLRefLenses
MakeURLRefLenses creates a new URLRefLenses with lenses for all fields
type UserinfoRefLenses ¶
type UserinfoRefLenses struct {
// mandatory fields
Username __lens.Lens[*url.Userinfo, string]
Password __lens.Lens[*url.Userinfo, string]
// optional fields
UsernameO __lens_option.LensO[*url.Userinfo, string]
PasswordO __lens_option.LensO[*url.Userinfo, string]
}
UserinfoRefLenses provides lenses for accessing fields of url.Userinfo via a reference to url.Userinfo
func MakeUserinfoRefLenses ¶
func MakeUserinfoRefLenses() UserinfoRefLenses
MakeUserinfoRefLenses creates a new UserinfoRefLenses with lenses for all fields