Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
5963cb2f
Vérifiée
Valider
5963cb2f
rédigé
Il y a 2 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
DB: Add a function to get informations about a kara
parent
139d6152
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
src/rust/lektor_db/src/connexion.rs
+25
-6
25 ajouts, 6 suppressions
src/rust/lektor_db/src/connexion.rs
avec
25 ajouts
et
6 suppressions
src/rust/lektor_db/src/connexion.rs
+
25
−
6
Voir le fichier @
5963cb2f
use
crate
::{
models
::
*
,
uri
::
LktUri
,
*
};
use
crate
::{
models
::
*
,
uri
::
LktUri
,
*
};
use
diesel
::
connection
::
DefaultLoadingMode
;
use
kurisu_api
::
v1
as
api_v1
;
use
kurisu_api
::
v1
as
api_v1
;
/// Create a connexion to a database and run automatically the migrations.
/// Create a connexion to a database and run automatically the migrations.
...
@@ -276,19 +277,37 @@ impl LktDatabaseConnection {
...
@@ -276,19 +277,37 @@ impl LktDatabaseConnection {
/// Get all infos about a kara, its metadata, its tags, repo, repo id,
/// Get all infos about a kara, its metadata, its tags, repo, repo id,
/// languages, karamakers...
/// languages, karamakers...
pub
fn
get_kara_info
(
&
mut
self
,
local_id
:
i64
)
->
LktDatabaseResult
<
()
>
{
pub
fn
get_kara_info
(
let
_repo
:
String
=
with_dsl!
(
repo_kara
=>
repo_kara
&
mut
self
,
local_id
:
i64
,
)
->
LktDatabaseResult
<
Vec
<
(
String
,
Option
<
String
>
)
>>
{
let
repo
:
String
=
with_dsl!
(
repo_kara
=>
repo_kara
.filter
(
local_kara_id
.is
(
local_id
))
.filter
(
local_kara_id
.is
(
local_id
))
.inner_join
(
schema
::
repo
::
table
)
.inner_join
(
schema
::
repo
::
table
)
.select
(
schema
::
repo
::
name
)
.select
(
schema
::
repo
::
name
)
.first
::
<
String
>
(
&
mut
self
.sqlite
)
?
.first
::
<
String
>
(
&
mut
self
.sqlite
)
?
);
);
let
_kara_maker
:
Vec
<
String
>
=
with_dsl!
(
kara
=>
kara
let
mut
ret
=
vec!
[(
String
::
from
(
"repo"
),
Some
(
repo
))];
for
kara_maker
in
with_dsl!
(
kara
=>
kara
.filter
(
id
.is
(
local_id
))
.filter
(
id
.is
(
local_id
))
.inner_join
(
schema
::
kara_maker
::
table
)
.inner_join
(
schema
::
kara_maker
::
table
)
.select
(
schema
::
kara_maker
::
name
)
.select
(
schema
::
kara_maker
::
name
)
.load
::
<
String
>
(
&
mut
self
.sqlite
)
?
.load_iter
::
<
String
,
DefaultLoadingMode
>
(
&
mut
self
.sqlite
)
?
);
)
{
todo!
()
ret
.push
((
String
::
from
(
"karamaker"
),
Some
(
kara_maker
?
)));
}
for
tag_entry
in
with_dsl!
(
kara_tag
=>
kara_tag
.filter
(
kara_id
.is
(
local_id
))
.inner_join
(
schema
::
tag
::
table
)
.select
((
schema
::
tag
::
name
,
value
))
.load_iter
::
<
(
String
,
Option
<
String
>
),
DefaultLoadingMode
>
(
&
mut
self
.sqlite
)
?
)
{
let
(
key
,
value
)
=
tag_entry
?
;
ret
.push
((
key
,
value
))
}
Ok
(
ret
)
}
}
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter