From 2d20ef21a135d3e734a69f52e3f8d69e71033082 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Thu, 6 Dec 2018 13:26:25 -0800 Subject: [PATCH] renamed --- context.go | 2 +- manipmongo/utils.go | 14 ++++---------- manipmongo/utils_test.go | 4 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/context.go b/context.go index 97cb875f..88c6c6c2 100644 --- a/context.go +++ b/context.go @@ -32,7 +32,7 @@ type WriteConsistency string // Various values for Consistency const ( WriteConsistencyDefault WriteConsistency = "default" - WriteConsistencyLow WriteConsistency = "low" + WriteConsistencyNone WriteConsistency = "none" WriteConsistencyStrong WriteConsistency = "strong" WriteConsistencyStrongest WriteConsistency = "strongest" ) diff --git a/manipmongo/utils.go b/manipmongo/utils.go index a089e8cd..c0012039 100644 --- a/manipmongo/utils.go +++ b/manipmongo/utils.go @@ -134,21 +134,15 @@ func convertReadConsistency(c manipulate.ReadConsistency) mgo.Mode { } } -var ( - defaultSafety = &mgo.Safe{} - strongSafety = &mgo.Safe{WMode: "majority"} - strongestSafety = &mgo.Safe{WMode: "majority", J: true} -) - func convertWriteConsistency(c manipulate.WriteConsistency) *mgo.Safe { switch c { - case manipulate.WriteConsistencyLow: + case manipulate.WriteConsistencyNone: return nil case manipulate.WriteConsistencyStrong: - return strongSafety + return &mgo.Safe{WMode: "majority"} case manipulate.WriteConsistencyStrongest: - return strongestSafety + return &mgo.Safe{WMode: "majority", J: true} default: - return defaultSafety + return &mgo.Safe{} } } diff --git a/manipmongo/utils_test.go b/manipmongo/utils_test.go index 71acdfd7..fd2775a8 100644 --- a/manipmongo/utils_test.go +++ b/manipmongo/utils_test.go @@ -367,8 +367,8 @@ func Test_convertWriteConsistency(t *testing.T) { want *mgo.Safe }{ { - "low", - args{manipulate.WriteConsistencyLow}, + "none", + args{manipulate.WriteConsistencyNone}, nil, }, {