@@ -104,9 +104,10 @@ func (e UnknownDatabaseTypeError) Error() string {
104104
105105// Open takes a string path to a file and returns a Reader struct or an error.
106106// The database file is opened using a memory map. Use the Close method on the
107- // Reader object to return the resources to the system.
108- func Open (file string ) (* Reader , error ) {
109- reader , err := maxminddb .Open (file )
107+ // Reader object to return the resources to the system. Any reader options
108+ // provided are passed directly to maxminddb.Open.
109+ func Open (file string , options ... maxminddb.ReaderOption ) (* Reader , error ) {
110+ reader , err := maxminddb .Open (file , options ... )
110111 if err != nil {
111112 return nil , err
112113 }
@@ -117,9 +118,10 @@ func Open(file string) (*Reader, error) {
117118// OpenBytes takes a byte slice corresponding to a GeoIP2/GeoLite2 database
118119// file and returns a Reader struct or an error. Note that the byte slice is
119120// used directly; any modification of it after opening the database will result
120- // in errors while reading from the database.
121- func OpenBytes (bytes []byte ) (* Reader , error ) {
122- reader , err := maxminddb .OpenBytes (bytes )
121+ // in errors while reading from the database. Any reader options provided are
122+ // passed directly to maxminddb.OpenBytes.
123+ func OpenBytes (bytes []byte , options ... maxminddb.ReaderOption ) (* Reader , error ) {
124+ reader , err := maxminddb .OpenBytes (bytes , options ... )
123125 if err != nil {
124126 return nil , err
125127 }
@@ -134,8 +136,8 @@ func OpenBytes(bytes []byte) (*Reader, error) {
134136//
135137// Deprecated: Use OpenBytes instead. FromBytes will be removed in a future
136138// version.
137- func FromBytes (bytes []byte ) (* Reader , error ) {
138- return OpenBytes (bytes )
139+ func FromBytes (bytes []byte , options ... maxminddb. ReaderOption ) (* Reader , error ) {
140+ return OpenBytes (bytes , options ... )
139141}
140142
141143func getDBType (reader * maxminddb.Reader ) (databaseType , error ) {
0 commit comments