Next version of DODB, some API changes.

master
Philippe PITTOLI 2024-06-01 02:44:53 +02:00
parent d790caa4e1
commit 7e6c733075
2 changed files with 7 additions and 7 deletions

View File

@ -31,8 +31,8 @@ dependencies:
git: https://git.baguette.netlib.re/Baguette/baguette-crystal-base
branch: master
dodb:
git: https://git.baguette.netlib.re/Baguette/dodb.cr
branch: master
git: https://git.baguette.netlib.re/Baguette/dodb.cr
cbor:
git: https://git.baguette.netlib.re/Baguette/crystal-cbor
branch: master

View File

@ -23,10 +23,10 @@ class AuthD::Service < IPC
property configuration : Baguette::Configuration::Auth
# DB and its indexes.
property users : DODB::DataBase(User)
property users_per_uid : DODB::Index(User)
property users_per_login : DODB::Index(User)
property users_per_email : DODB::Index(User)
property users : DODB::Storage::Cached(User)
property users_per_uid : DODB::Trigger(User)
property users_per_login : DODB::Trigger(User)
property users_per_email : DODB::Trigger(User)
property logged_users : Hash(Int32, AuthD::User::Public)
@ -36,14 +36,14 @@ class AuthD::Service < IPC
def initialize(@configuration)
super()
@users = DODB::DataBase(User).new @configuration.storage
@users = DODB::Storage::Cached(User).new @configuration.storage
@users_per_uid = @users.new_index "uid", &.uid.to_s
@users_per_login = @users.new_index "login", &.login
@users_per_email = @users.new_index "email" do |user|
if mail = user.contact.email
Base64.encode(mail).chomp
else
""
DODB.no_index
end
end