mirror of
https://github.com/gomods/athens
synced 2026-02-03 12:10:32 +00:00
* Changed mongo.go to use new driver * Modified mongo cataloger * More new driver related changes * Change lister.go * Change saver.go * Change imports * Remove unnecessary Count query * Use IndexView for indexing * Rename ModuleStore fields * Use map of key:sorting-order for creating the index * Minor changes * Use client options to configure mongo client * Use method chaining * gofmt changes * Change imports * Fix some build errors * Use new GridFS API * Fix more build errors * Add Go Mongo driver to dependency modules * Use multierror * Leave download stream open * Remove mgo error handling * Copy zip instead of loading all in memory * Use context.WithTimeout() wherever possible * Raise KindNotFound when mod@ver isn't found * NopCloser not needed * Fix IndexView error * Fix build errors * Remove another mgo error usage * Fix build error * Changes according to review * Formatting changes as per gofmt * Modify gofmt argument to show the expected formatting (diff) * Handle ErrNoDocument error and error arising from query execution * Fix kind of returned error * Minor changes * Bug fixes * gofmt related changes * Minor change * Use Insecure from MongoConfig, remove Insecure from global Config * Remove stray print statement
43 lines
1.5 KiB
Go
43 lines
1.5 KiB
Go
// Copyright (C) MongoDB, Inc. 2017-present.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
// not use this file except in compliance with the License. You may obtain
|
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
// Package bson is a library for reading, writing, and manipulating BSON. The
|
|
// library has two families of types for representing BSON.
|
|
//
|
|
// The Raw family of types is used to validate and retrieve elements from a slice of bytes. This
|
|
// type is most useful when you want do lookups on BSON bytes without unmarshaling it into another
|
|
// type.
|
|
//
|
|
// Example:
|
|
// var raw bson.Raw = ... // bytes from somewhere
|
|
// err := raw.Validate()
|
|
// if err != nil { return err }
|
|
// val := raw.Lookup("foo")
|
|
// i32, ok := val.Int32OK()
|
|
// // do something with i32...
|
|
//
|
|
// The D family of types is used to build concise representations of BSON using native Go types.
|
|
// These types do not support automatic lookup.
|
|
//
|
|
// Example:
|
|
// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}}
|
|
//
|
|
//
|
|
// Marshaling and Unmarshaling are handled with the Marshal and Unmarshal family of functions. If
|
|
// you need to write or read BSON from a non-slice source, an Encoder or Decoder can be used with a
|
|
// bsonrw.ValueWriter or bsonrw.ValueReader.
|
|
//
|
|
// Example:
|
|
// b, err := bson.Marshal(bson.D{{"foo", "bar"}})
|
|
// if err != nil { return err }
|
|
// var fooer struct {
|
|
// Foo string
|
|
// }
|
|
// err = bson.Unmarshal(b, &fooer)
|
|
// if err != nil { return err }
|
|
// // do something with fooer...
|
|
package bson
|