github.com/m4gshm/gollections@v0.0.10/map_/resolv/api.go (about)

     1  // Package resolv provides values resolvers for maps thath builded by iterating over key/values loop, slice or collection
     2  package resolv
     3  
     4  import (
     5  	"github.com/m4gshm/gollections/op"
     6  )
     7  
     8  // First - ToMap value resolver
     9  func First[K, V any](exists bool, _ K, old, new V) V { return op.IfElse(exists, old, new) }
    10  
    11  // Last - ToMap value resolver
    12  func Last[K, V any](_ bool, _ K, _, new V) V { return new }
    13  
    14  // Append - ToMap value resolver
    15  func Append[K, V any](_ bool, _ K, rv []V, v V) []V {
    16  	return append(rv, v)
    17  }