| 1 | // Copyright (C) MongoDB, Inc. 2017-present. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | // not use this file except in compliance with the License. You may obtain |
| 5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | |
| 7 | package mtestscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/ |
| 8 | |
| 9 | // SetupOptions is the type used to configure mtest setup |
| 10 | type SetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions# struct { |
| 11 | // Specifies the URI to connect to. Defaults to URI based on the environment variables MONGODB_URI, |
| 12 | // MONGO_GO_DRIVER_CA_FILE, and MONGO_GO_DRIVER_COMPRESSOR |
| 13 | URIscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#URI. *string |
| 14 | } |
| 15 | |
| 16 | // NewSetupOptions creates an empty SetupOptions struct |
| 17 | func NewSetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/NewSetupOptions().() *SetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions# { |
| 18 | return &SetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#{} |
| 19 | } |
| 20 | |
| 21 | // SetURI sets the uri to connect to |
| 22 | func (so *SetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#) SetURIscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#SetURI().(uri string) *SetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions# { |
| 23 | so.URIscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#URI. = &uri |
| 24 | return so |
| 25 | } |
| 26 | |
| 27 | // MergeSetupOptions combines the given *SetupOptions into a single *Options in a last one wins fashion. |
| 28 | // |
| 29 | // Deprecated: Merging options structs will not be supported in Go Driver 2.0. Users should create a |
| 30 | // single options struct instead. |
| 31 | func MergeSetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/MergeSetupOptions().(opts ...*SetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#) *SetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions# { |
| 32 | op := NewSetupOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/NewSetupOptions().() |
| 33 | for _, opt := range opts { |
| 34 | if opt == nil { |
| 35 | continue |
| 36 | } |
| 37 | if opt.URIscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#URI. != nil { |
| 38 | op.URIscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#URI. = opt.URIscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/integration/mtest`/SetupOptions#URI. |
| 39 | } |
| 40 | } |
| 41 | return op |
| 42 | } |