github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/internal/examples/mapexamples/type_User.go (about)

     1  package mapexamples
     2  
     3  type User struct {
     4  	name  string
     5  	age   int
     6  	roles []Role
     7  }
     8  
     9  type Role struct {
    10  	name string
    11  }
    12  
    13  func (u Role) Name() string {
    14  	return u.name
    15  }
    16  
    17  func (u User) Name() string {
    18  	return u.name
    19  }
    20  
    21  func (u User) Age() int {
    22  	return u.age
    23  }
    24  
    25  func (u User) Roles() []Role {
    26  	return u.roles
    27  }