...

Source file src/github.com/go-kivik/kivik/v4/mockdb/client_gen.go

Documentation: github.com/go-kivik/kivik/v4/mockdb

     1  /* This file is auto-generated. Do not edit it! */
     2  
     3  package mockdb
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/go-kivik/kivik/v4/driver"
     9  )
    10  
    11  var _ = (*driver.Attachment)(nil)
    12  
    13  func (c *driverClient) AllDBs(ctx context.Context, options driver.Options) ([]string, error) {
    14  	expected := &ExpectedAllDBs{
    15  		commonExpectation: commonExpectation{
    16  			options: options,
    17  		},
    18  	}
    19  	if err := c.nextExpectation(expected); err != nil {
    20  		return nil, err
    21  	}
    22  	if expected.callback != nil {
    23  		return expected.callback(ctx, options)
    24  	}
    25  	return expected.ret0, expected.wait(ctx)
    26  }
    27  
    28  func (c *driverClient) Close() error {
    29  	expected := &ExpectedClose{}
    30  	if err := c.nextExpectation(expected); err != nil {
    31  		return err
    32  	}
    33  	if expected.callback != nil {
    34  		return expected.callback()
    35  	}
    36  	return expected.err
    37  }
    38  
    39  func (c *driverClient) ClusterSetup(ctx context.Context, arg0 interface{}) error {
    40  	expected := &ExpectedClusterSetup{
    41  		arg0: arg0,
    42  	}
    43  	if err := c.nextExpectation(expected); err != nil {
    44  		return err
    45  	}
    46  	if expected.callback != nil {
    47  		return expected.callback(ctx, arg0)
    48  	}
    49  	return expected.wait(ctx)
    50  }
    51  
    52  func (c *driverClient) ClusterStatus(ctx context.Context, options driver.Options) (string, error) {
    53  	expected := &ExpectedClusterStatus{
    54  		commonExpectation: commonExpectation{
    55  			options: options,
    56  		},
    57  	}
    58  	if err := c.nextExpectation(expected); err != nil {
    59  		return "", err
    60  	}
    61  	if expected.callback != nil {
    62  		return expected.callback(ctx, options)
    63  	}
    64  	return expected.ret0, expected.wait(ctx)
    65  }
    66  
    67  func (c *driverClient) ConfigValue(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error) {
    68  	expected := &ExpectedConfigValue{
    69  		arg0: arg0,
    70  		arg1: arg1,
    71  		arg2: arg2,
    72  	}
    73  	if err := c.nextExpectation(expected); err != nil {
    74  		return "", err
    75  	}
    76  	if expected.callback != nil {
    77  		return expected.callback(ctx, arg0, arg1, arg2)
    78  	}
    79  	return expected.ret0, expected.wait(ctx)
    80  }
    81  
    82  func (c *driverClient) DBExists(ctx context.Context, arg0 string, options driver.Options) (bool, error) {
    83  	expected := &ExpectedDBExists{
    84  		arg0: arg0,
    85  		commonExpectation: commonExpectation{
    86  			options: options,
    87  		},
    88  	}
    89  	if err := c.nextExpectation(expected); err != nil {
    90  		return false, err
    91  	}
    92  	if expected.callback != nil {
    93  		return expected.callback(ctx, arg0, options)
    94  	}
    95  	return expected.ret0, expected.wait(ctx)
    96  }
    97  
    98  func (c *driverClient) DeleteConfigKey(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error) {
    99  	expected := &ExpectedDeleteConfigKey{
   100  		arg0: arg0,
   101  		arg1: arg1,
   102  		arg2: arg2,
   103  	}
   104  	if err := c.nextExpectation(expected); err != nil {
   105  		return "", err
   106  	}
   107  	if expected.callback != nil {
   108  		return expected.callback(ctx, arg0, arg1, arg2)
   109  	}
   110  	return expected.ret0, expected.wait(ctx)
   111  }
   112  
   113  func (c *driverClient) DestroyDB(ctx context.Context, arg0 string, options driver.Options) error {
   114  	expected := &ExpectedDestroyDB{
   115  		arg0: arg0,
   116  		commonExpectation: commonExpectation{
   117  			options: options,
   118  		},
   119  	}
   120  	if err := c.nextExpectation(expected); err != nil {
   121  		return err
   122  	}
   123  	if expected.callback != nil {
   124  		return expected.callback(ctx, arg0, options)
   125  	}
   126  	return expected.wait(ctx)
   127  }
   128  
   129  func (c *driverClient) Ping(ctx context.Context) (bool, error) {
   130  	expected := &ExpectedPing{}
   131  	if err := c.nextExpectation(expected); err != nil {
   132  		return false, err
   133  	}
   134  	if expected.callback != nil {
   135  		return expected.callback(ctx)
   136  	}
   137  	return expected.ret0, expected.wait(ctx)
   138  }
   139  
   140  func (c *driverClient) SetConfigValue(ctx context.Context, arg0 string, arg1 string, arg2 string, arg3 string) (string, error) {
   141  	expected := &ExpectedSetConfigValue{
   142  		arg0: arg0,
   143  		arg1: arg1,
   144  		arg2: arg2,
   145  		arg3: arg3,
   146  	}
   147  	if err := c.nextExpectation(expected); err != nil {
   148  		return "", err
   149  	}
   150  	if expected.callback != nil {
   151  		return expected.callback(ctx, arg0, arg1, arg2, arg3)
   152  	}
   153  	return expected.ret0, expected.wait(ctx)
   154  }
   155  
   156  func (c *driverClient) AllDBsStats(ctx context.Context, options driver.Options) ([]*driver.DBStats, error) {
   157  	expected := &ExpectedAllDBsStats{
   158  		commonExpectation: commonExpectation{
   159  			options: options,
   160  		},
   161  	}
   162  	if err := c.nextExpectation(expected); err != nil {
   163  		return nil, err
   164  	}
   165  	if expected.callback != nil {
   166  		return expected.callback(ctx, options)
   167  	}
   168  	return expected.ret0, expected.wait(ctx)
   169  }
   170  
   171  func (c *driverClient) Config(ctx context.Context, arg0 string) (driver.Config, error) {
   172  	expected := &ExpectedConfig{
   173  		arg0: arg0,
   174  	}
   175  	if err := c.nextExpectation(expected); err != nil {
   176  		return nil, err
   177  	}
   178  	if expected.callback != nil {
   179  		return expected.callback(ctx, arg0)
   180  	}
   181  	return expected.ret0, expected.wait(ctx)
   182  }
   183  
   184  func (c *driverClient) ConfigSection(ctx context.Context, arg0 string, arg1 string) (driver.ConfigSection, error) {
   185  	expected := &ExpectedConfigSection{
   186  		arg0: arg0,
   187  		arg1: arg1,
   188  	}
   189  	if err := c.nextExpectation(expected); err != nil {
   190  		return nil, err
   191  	}
   192  	if expected.callback != nil {
   193  		return expected.callback(ctx, arg0, arg1)
   194  	}
   195  	return expected.ret0, expected.wait(ctx)
   196  }
   197  
   198  func (c *driverClient) DB(arg0 string, options driver.Options) (driver.DB, error) {
   199  	expected := &ExpectedDB{
   200  		arg0: arg0,
   201  		commonExpectation: commonExpectation{
   202  			options: options,
   203  		},
   204  	}
   205  	if err := c.nextExpectation(expected); err != nil {
   206  		return nil, err
   207  	}
   208  	expected.ret0.mu.Lock()
   209  	expected.ret0.name = arg0
   210  	expected.ret0.mu.Unlock()
   211  	if expected.callback != nil {
   212  		return expected.callback(arg0, options)
   213  	}
   214  	return &driverDB{DB: expected.ret0}, expected.err
   215  }
   216  
   217  func (c *driverClient) DBUpdates(ctx context.Context, options driver.Options) (driver.DBUpdates, error) {
   218  	expected := &ExpectedDBUpdates{
   219  		commonExpectation: commonExpectation{
   220  			options: options,
   221  		},
   222  	}
   223  	if err := c.nextExpectation(expected); err != nil {
   224  		return nil, err
   225  	}
   226  	if expected.callback != nil {
   227  		return expected.callback(ctx, options)
   228  	}
   229  	return &driverDBUpdates{Context: ctx, Updates: coalesceDBUpdates(expected.ret0)}, expected.wait(ctx)
   230  }
   231  
   232  func (c *driverClient) DBsStats(ctx context.Context, arg0 []string) ([]*driver.DBStats, error) {
   233  	expected := &ExpectedDBsStats{
   234  		arg0: arg0,
   235  	}
   236  	if err := c.nextExpectation(expected); err != nil {
   237  		return nil, err
   238  	}
   239  	if expected.callback != nil {
   240  		return expected.callback(ctx, arg0)
   241  	}
   242  	return expected.ret0, expected.wait(ctx)
   243  }
   244  
   245  func (c *driverClient) GetReplications(ctx context.Context, options driver.Options) ([]driver.Replication, error) {
   246  	expected := &ExpectedGetReplications{
   247  		commonExpectation: commonExpectation{
   248  			options: options,
   249  		},
   250  	}
   251  	if err := c.nextExpectation(expected); err != nil {
   252  		return nil, err
   253  	}
   254  	if expected.callback != nil {
   255  		return expected.callback(ctx, options)
   256  	}
   257  	return driverReplications(expected.ret0), expected.wait(ctx)
   258  }
   259  
   260  func (c *driverClient) Membership(ctx context.Context) (*driver.ClusterMembership, error) {
   261  	expected := &ExpectedMembership{}
   262  	if err := c.nextExpectation(expected); err != nil {
   263  		return nil, err
   264  	}
   265  	if expected.callback != nil {
   266  		return expected.callback(ctx)
   267  	}
   268  	return expected.ret0, expected.wait(ctx)
   269  }
   270  
   271  func (c *driverClient) Replicate(ctx context.Context, arg0 string, arg1 string, options driver.Options) (driver.Replication, error) {
   272  	expected := &ExpectedReplicate{
   273  		arg0: arg0,
   274  		arg1: arg1,
   275  		commonExpectation: commonExpectation{
   276  			options: options,
   277  		},
   278  	}
   279  	if err := c.nextExpectation(expected); err != nil {
   280  		return nil, err
   281  	}
   282  	if expected.callback != nil {
   283  		return expected.callback(ctx, arg0, arg1, options)
   284  	}
   285  	return &driverReplication{Replication: expected.ret0}, expected.wait(ctx)
   286  }
   287  
   288  func (c *driverClient) Session(ctx context.Context) (*driver.Session, error) {
   289  	expected := &ExpectedSession{}
   290  	if err := c.nextExpectation(expected); err != nil {
   291  		return nil, err
   292  	}
   293  	if expected.callback != nil {
   294  		return expected.callback(ctx)
   295  	}
   296  	return expected.ret0, expected.wait(ctx)
   297  }
   298  
   299  func (c *driverClient) Version(ctx context.Context) (*driver.Version, error) {
   300  	expected := &ExpectedVersion{}
   301  	if err := c.nextExpectation(expected); err != nil {
   302  		return nil, err
   303  	}
   304  	if expected.callback != nil {
   305  		return expected.callback(ctx)
   306  	}
   307  	return expected.ret0, expected.wait(ctx)
   308  }
   309  

View as plain text