Giter Club home page Giter Club logo

Comments (4)

tobiemh avatar tobiemh commented on May 3, 2024 2

Hi @demfabris thank you!

Would love to have you involved with the project, and contributing!

This issue is actually almost completed (bcaea75). The only issue at the moment is that if you change the NS/DB using it is not reflected...

-- These will use the configured NS / DB when connecting...
SELECT * FROM $session.ns;
SELECT * FROM $session.db;
SELECT * FROM session::ns();
SELECT * FROM session::db();
-- If you then change to another NS / DB...
USE NS test DB test;
-- Then the change is not yet reflected in these functions...
SELECT * FROM $session.ns;
SELECT * FROM $session.db;
SELECT * FROM session::ns();
SELECT * FROM session::db();

from surrealdb.

demfabris avatar demfabris commented on May 3, 2024

Hi, came here from r/rust. Would love to help

from surrealdb.

tobiemh avatar tobiemh commented on May 3, 2024

@demfabris the code where this happens is ...

Statement::Use(stm) => {
if let Some(ref ns) = stm.ns {
match &*opt.auth {
Auth::No => opt.ns = Some(Arc::new(ns.to_owned())),
Auth::Kv => opt.ns = Some(Arc::new(ns.to_owned())),
Auth::Ns(v) if v == ns => opt.ns = Some(Arc::new(ns.to_owned())),
_ => {
opt.ns = None;
return Err(Error::NsNotAllowed {
ns: ns.to_owned(),
});
}
}
}
if let Some(ref db) = stm.db {
match &*opt.auth {
Auth::No => opt.db = Some(Arc::new(db.to_owned())),
Auth::Kv => opt.db = Some(Arc::new(db.to_owned())),
Auth::Ns(_) => opt.db = Some(Arc::new(db.to_owned())),
Auth::Db(_, v) if v == db => opt.db = Some(Arc::new(db.to_owned())),
_ => {
opt.db = None;
return Err(Error::DbNotAllowed {
db: db.to_owned(),
});
}
}
}
Ok(Value::None)
}

It should be relatively easy to change the NS/DB stored in the $session context here too, but I'm just thinking whether there is a better way of going about this...

from surrealdb.

demfabris avatar demfabris commented on May 3, 2024

I'm unable to make progress because of #52. Still trying to figure out a workaround

edit: #58

from surrealdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.