func New(ctx context.Context, remoteURL, appURL string) (*Repo, error) {
	remoteClient, err := remoteConnection(remoteURL)
	if err != nil {
		return nil, err
	}
	httpClient, err := chttp.New(ctx, remoteURL)
	if err != nil {
		return nil, err
	}
	localClient, err := localConnection()
	if err != nil {
		return nil, err
	}
	if e := localClient.CreateDB(ctx, stateDB); e != nil && kivik.StatusCode(e) != kivik.StatusConflict {
		return nil, e
	}
	stateDB, err := localClient.DB(ctx, stateDB)
	if err != nil {
		return nil, err
	}
	setTransport(httpClient)
	return &Repo{
		chttp:  httpClient,
		remote: remoteClient,
		local:  localClient,
		state:  stateDB,
		appURL: appURL,
	}, nil
}
// New returns a new Repo instance, pointing to the specified remote server.
New returns a new Repo instance, pointing to the specified remote server.
// New returns a new Repo instance pointing to the specified remote server .
func New(ctx context.Context, remoteURL, appURL string) (*Repo, error) {
	remoteClient, err := remoteConnection(remoteURL)
	if err != nil {
		return nil, err
	}
	httpClient, err := chttp.New(ctx, remoteURL)
	if err != nil {
		return nil, err
	}
	localClient, err := localConnection()
	if err != nil {
		return nil, err
	}
	if e := localClient.CreateDB(ctx, stateDB); e != nil && kivik.StatusCode(e) != kivik.StatusConflict {
		return nil, e
	}
	stateDB, err := localClient.DB(ctx, stateDB)
	if err != nil {
		return nil, err
	}
	setTransport(httpClient)
	return &Repo{
		chttp:  httpClient,
		remote: remoteClient,
		local:  localClient,
		state:  stateDB,
		appURL: appURL,
	}, nil
}
func New ( ctx context . Context , remoteURL , appURL string ) ( * Repo , error ) { remoteClient , err := remoteConnection ( remoteURL ) if err != nil { return nil , err } httpClient , err := chttp . New ( ctx , remoteURL ) if err != nil { return nil , err } localClient , err := localConnection ( ) if err != nil { return nil , err } if e := localClient . CreateDB ( ctx , stateDB ) ; e != nil && kivik . StatusCode ( e ) != kivik . StatusConflict { return nil , e } stateDB , err := localClient . DB ( ctx , stateDB ) if err != nil { return nil , err } setTransport ( httpClient ) return & Repo { chttp : httpClient , remote : remoteClient , local : localClient , state : stateDB , appURL : appURL , } , nil }
New returns a new Repo instance, pointing to the specified remote server.
New returns a new Repo instance pointing to the specified remote server .