github.com/justinjmoses/evergreen@v0.0.0-20170530173719-1d50e381ff0d/rest/data/impl.go (about)

     1  package data
     2  
     3  // DBConnector is a struct that implements all of the methods which
     4  // connect to the service layer of evergreen. These methods abstract the link
     5  // between the service and the API layers, allowing for changes in the
     6  // service architecture without forcing changes to the API.
     7  type DBConnector struct {
     8  	superUsers []string
     9  	URL        string
    10  	Prefix     string
    11  
    12  	DBUserConnector
    13  	DBTaskConnector
    14  	DBContextConnector
    15  	DBHostConnector
    16  	DBTestConnector
    17  }
    18  
    19  func (ctx *DBConnector) GetSuperUsers() []string   { return ctx.superUsers }
    20  func (ctx *DBConnector) SetSuperUsers(su []string) { ctx.superUsers = su }
    21  func (ctx *DBConnector) GetURL() string            { return ctx.URL }
    22  func (ctx *DBConnector) SetURL(url string)         { ctx.URL = url }
    23  func (ctx *DBConnector) GetPrefix() string         { return ctx.Prefix }
    24  func (ctx *DBConnector) SetPrefix(prefix string)   { ctx.Prefix = prefix }
    25  
    26  type MockConnector struct {
    27  	superUsers []string
    28  	URL        string
    29  	Prefix     string
    30  
    31  	MockUserConnector
    32  	MockTaskConnector
    33  	MockContextConnector
    34  	MockHostConnector
    35  	MockTestConnector
    36  }
    37  
    38  func (ctx *MockConnector) GetSuperUsers() []string   { return ctx.superUsers }
    39  func (ctx *MockConnector) SetSuperUsers(su []string) { ctx.superUsers = su }
    40  func (ctx *MockConnector) GetURL() string            { return ctx.URL }
    41  func (ctx *MockConnector) SetURL(url string)         { ctx.URL = url }
    42  func (ctx *MockConnector) GetPrefix() string         { return ctx.Prefix }
    43  func (ctx *MockConnector) SetPrefix(prefix string)   { ctx.Prefix = prefix }