func parseAndCheckParameters(params ...Parameter) (*parameters, error) {
	parameters := parameters{
		logLevel: zerolog.GlobalLevel(),
	}
	for _, p := range params {
		if params != nil {
			p.apply(&parameters)
		}
	}
	if parameters.eth2Client == nil {
		return nil, errors.New("no Ethereum 2 client specified")
	}
	if parameters.chainDB == nil {
		return nil, errors.New("no chain database specified")
	}
	return &parameters, nil
}
parseAndCheckParameters parses and checks parameters to ensure that mandatory parameters are present and correct.
package standard
import (
	"errors"
	eth2client "github.com/attestantio/go-eth2-client"
	"github.com/rs/zerolog"
	"github.com/wealdtech/chaind/services/chaindb"
)
type parameters struct {
	logLevel   zerolog.Level
	eth2Client eth2client.Service
	chainDB    chaindb.Service
}
type Parameter interface {
	apply(*parameters)
}
type parameterFunc func(*parameters)
func (f parameterFunc) apply(p *parameters) {
	f(p)
}
func WithLogLevel(logLevel zerolog.Level) Parameter {
	return parameterFunc(func(p *parameters) {
		p.logLevel = logLevel
	})
}
func WithETH2Client(eth2Client eth2client.Service) Parameter {
	return parameterFunc(func(p *parameters) {
		p.eth2Client = eth2Client
	})
}
func WithChainDB(chainDB chaindb.Service) Parameter {
	return parameterFunc(func(p *parameters) {
		p.chainDB = chainDB
	})
}