github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/x/contextx/context.go (about)

     1  package contextx
     2  
     3  import "context"
     4  
     5  type WithContext = func(ctx context.Context) context.Context
     6  
     7  func WithContextCompose(withs ...WithContext) WithContext {
     8  	return func(ctx context.Context) context.Context {
     9  		for i := range withs {
    10  			ctx = withs[i](ctx)
    11  		}
    12  		return ctx
    13  	}
    14  }
    15  
    16  func WithInjectFrom(from context.Context) WithContext {
    17  	return func(ctx context.Context) context.Context {
    18  		return from
    19  	}
    20  }