// NewAdapterWithClientOption is an alternative constructor for Adapter
// that does the same as NewAdapter, but uses mongo.ClientOption instead of a Mongo URL
NewAdapterWithClientOption is an alternative constructor for Adapter
that does the same as NewAdapter, but uses mongo.ClientOption instead of a Mongo URL
// NewAdapterWithClientOption is an alternative constructor for Adapter // that does the same as NewAdapter but uses mongo . ClientOption instead of a Mongo URL
func NewAdapterWithClientOption(clientOption *options.ClientOptions, databaseName string, timeout ...interface{}) (persist.Adapter, error) {
	a := &adapter{
		clientOption: clientOption,
	}
	a.filtered = false
	if len(timeout) == 1 {
		a.timeout = timeout[0].(time.Duration)
	} else if len(timeout) > 1 {
		return nil, errors.New("too many arguments")
	} else {
		a.timeout = defaultTimeout
	}
	err := a.open(databaseName)
	if err != nil {
		return nil, err
	}
	runtime.SetFinalizer(a, finalizer)
	return a, nil
}
func NewAdapterWithClientOption ( clientOption * options . ClientOptions , databaseName string , timeout ... interface { } ) ( persist . Adapter , error ) { a := & adapter { clientOption : clientOption , } a . filtered = false if len ( timeout ) == 1 { a . timeout = timeout [ 0 ] . ( time . Duration ) } else if len ( timeout ) > 1 { return nil , errors . New ( " " ) } else { a . timeout = defaultTimeout } err := a . open ( databaseName ) if err != nil { return nil , err } runtime . SetFinalizer ( a , finalizer ) return a , nil }
NewAdapterWithClientOption is an alternative constructor for Adapter
that does the same as NewAdapter, but uses mongo.ClientOption instead of a Mongo URL
NewAdapterWithClientOption is an alternative constructor for Adapter that does the same as NewAdapter but uses mongo . ClientOption instead of a Mongo URL
// Open the DB, create it if not existed. // Call the destructor when the object is released.