func (d *Driver) NewClient(_ context.Context, dsn string) (driver.Client, error) {
	var u *url.URL
	var auth authenticator
	var user *url.Userinfo
	if dsn != "" {
		var err error
		u, err = url.Parse(dsn)
		if err != nil {
			return nil, fmt.Errorf("Invalid DSN URL '%s' provided: %s", dsn, err)
		}
		user = u.User
		u.User = nil
	}
	pouch := bindings.GlobalPouchDB()
	client := &client{
		dsn:   u,
		pouch: pouch,
		opts:  make(map[string]Options),
	}
	if user != nil {
		pass, _ := user.Password()
		auth = &BasicAuth{
			Name:     user.Username(),
			Password: pass,
		}
		if err := auth.authenticate(client); err != nil {
			return nil, err
		}
	}
	return client, nil
}
// NewClient returns a PouchDB client handle. Provide a dsn only for remote
// databases. Otherwise specify ""
NewClient returns a PouchDB client handle. Provide a dsn only for remote
databases. Otherwise specify ""
// NewClient returns a PouchDB client handle . Provide a dsn only for remote // databases . Otherwise specify " "
func (d *Driver) NewClient(_ context.Context, dsn string) (driver.Client, error) {
	var u *url.URL
	var auth authenticator
	var user *url.Userinfo
	if dsn != "" {
		var err error
		u, err = url.Parse(dsn)
		if err != nil {
			return nil, fmt.Errorf("Invalid DSN URL '%s' provided: %s", dsn, err)
		}
		user = u.User
		u.User = nil
	}
	pouch := bindings.GlobalPouchDB()
	client := &client{
		dsn:   u,
		pouch: pouch,
		opts:  make(map[string]Options),
	}
	if user != nil {
		pass, _ := user.Password()
		auth = &BasicAuth{
			Name:     user.Username(),
			Password: pass,
		}
		if err := auth.authenticate(client); err != nil {
			return nil, err
		}
	}
	return client, nil
}
func ( d * Driver ) NewClient ( _ context . Context , dsn string ) ( driver . Client , error ) { var u * url . URL var auth authenticator var user * url . Userinfo if dsn != " " { var err error u , err = url . Parse ( dsn ) if err != nil { return nil , fmt . Errorf ( " " , dsn , err ) } user = u . User u . User = nil } pouch := bindings . GlobalPouchDB ( ) client := & client { dsn : u , pouch : pouch , opts : make ( map [ string ] Options ) , } if user != nil { pass , _ := user . Password ( ) auth = & BasicAuth { Name : user . Username ( ) , Password : pass , } if err := auth . authenticate ( client ) ; err != nil { return nil , err } } return client , nil }
NewClient returns a PouchDB client handle.
NewClient returns a PouchDB client handle .