1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-11-29 22:38:29 +02:00

fix: improve lens generation

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2025-11-12 17:28:20 +01:00
parent ca813b673c
commit 6f7ec0768d
5 changed files with 435 additions and 19 deletions

View File

@@ -2,7 +2,7 @@ package lens
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2025-11-07 16:52:17.4935733 +0100 CET m=+0.003883901
// 2025-11-12 17:16:40.1431921 +0100 CET m=+0.003694701
import (
L "github.com/IBM/fp-go/v2/optics/lens"
@@ -55,15 +55,15 @@ func MakePersonLenses() PersonLenses {
func MakePersonRefLenses() PersonRefLenses {
isoPhone := I.FromZero[*string]()
return PersonRefLenses{
Name: L.MakeLensRef(
Name: L.MakeLensStrict(
func(s *Person) string { return s.Name },
func(s *Person, v string) *Person { s.Name = v; return s },
),
Age: L.MakeLensRef(
Age: L.MakeLensStrict(
func(s *Person) int { return s.Age },
func(s *Person, v int) *Person { s.Age = v; return s },
),
Email: L.MakeLensRef(
Email: L.MakeLensStrict(
func(s *Person) string { return s.Email },
func(s *Person, v string) *Person { s.Email = v; return s },
),
@@ -123,19 +123,19 @@ func MakeAddressLenses() AddressLenses {
func MakeAddressRefLenses() AddressRefLenses {
isoState := I.FromZero[*string]()
return AddressRefLenses{
Street: L.MakeLensRef(
Street: L.MakeLensStrict(
func(s *Address) string { return s.Street },
func(s *Address, v string) *Address { s.Street = v; return s },
),
City: L.MakeLensRef(
City: L.MakeLensStrict(
func(s *Address) string { return s.City },
func(s *Address, v string) *Address { s.City = v; return s },
),
ZipCode: L.MakeLensRef(
ZipCode: L.MakeLensStrict(
func(s *Address) string { return s.ZipCode },
func(s *Address, v string) *Address { s.ZipCode = v; return s },
),
Country: L.MakeLensRef(
Country: L.MakeLensStrict(
func(s *Address) string { return s.Country },
func(s *Address, v string) *Address { s.Country = v; return s },
),
@@ -189,15 +189,15 @@ func MakeCompanyLenses() CompanyLenses {
func MakeCompanyRefLenses() CompanyRefLenses {
isoWebsite := I.FromZero[*string]()
return CompanyRefLenses{
Name: L.MakeLensRef(
Name: L.MakeLensStrict(
func(s *Company) string { return s.Name },
func(s *Company, v string) *Company { s.Name = v; return s },
),
Address: L.MakeLensRef(
Address: L.MakeLensStrict(
func(s *Company) Address { return s.Address },
func(s *Company, v Address) *Company { s.Address = v; return s },
),
CEO: L.MakeLensRef(
CEO: L.MakeLensStrict(
func(s *Company) Person { return s.CEO },
func(s *Company, v Person) *Company { s.CEO = v; return s },
),