1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-06-23 00:27:49 +02:00
Files
fp-go/context/readerioeither/resource.go
Dr. Carsten Leue b25de3c7c3 doc: fix case
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
2023-07-18 15:57:54 +02:00

12 lines
478 B
Go

package readerioeither
import (
G "github.com/IBM/fp-go/context/readerioeither/generic"
)
// WithResource constructs a function that creates a resource, then operates on it and then releases the resource
func WithResource[R, A, ANY any](onCreate ReaderIOEither[R], onRelease func(R) ReaderIOEither[ANY]) func(func(R) ReaderIOEither[A]) ReaderIOEither[A] {
// wraps the callback functions with a context check
return G.WithResource[ReaderIOEither[A]](onCreate, onRelease)
}