Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
P
PlayBot 2
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de conteneur
Registre de modèles
Opération
Environnements
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Ce projet est archivé. Le dépôt et les autres ressources du projet sont en lecture seule.
Afficher davantage de fils d'Ariane
Alexandre MORIGNOT
PlayBot 2
Validations
9a79d575
Valider
9a79d575
rédigé
8 years ago
par
Alexandre Morignot
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Post works ! Except for tags
parent
fa176d83
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
bot/collection.go
+13
-0
13 ajouts, 0 suppression
bot/collection.go
bot/db.go
+24
-4
24 ajouts, 4 suppressions
bot/db.go
bot/post.go
+6
-5
6 ajouts, 5 suppressions
bot/post.go
avec
43 ajouts
et
9 suppressions
bot/collection.go
+
13
−
0
Voir le fichier @
9a79d575
...
@@ -33,6 +33,19 @@ func (pbc *PlayBotCollection) GetByUrl(url string) (*site.Content, error) {
...
@@ -33,6 +33,19 @@ func (pbc *PlayBotCollection) GetByUrl(url string) (*site.Content, error) {
}
}
func
(
pbc
*
PlayBotCollection
)
InsertPost
(
post
*
Post
)
error
{
func
(
pbc
*
PlayBotCollection
)
InsertPost
(
post
*
Post
)
error
{
err
:=
pbc
.
Db
.
Insert
(
post
.
Content
)
.
Error
()
if
err
!=
nil
{
// TODO: check error type
var
content
site
.
Content
err
=
pbc
.
Db
.
Where
(
&
site
.
Content
{
Url
:
post
.
Content
.
Url
})
.
First
(
&
content
)
.
Error
()
if
err
!=
nil
{
return
err
}
post
.
Content
=
&
content
}
pbc
.
Db
.
Insert
(
post
)
pbc
.
Db
.
Insert
(
post
)
return
nil
return
nil
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
bot/db.go
+
24
−
4
Voir le fichier @
9a79d575
...
@@ -17,7 +17,10 @@ type DbParams struct {
...
@@ -17,7 +17,10 @@ type DbParams struct {
}
}
type
Db
interface
{
type
Db
interface
{
Insert
(
interface
{})
error
Insert
(
interface
{})
Db
Error
()
error
First
(
interface
{})
Db
Where
(
interface
{})
Db
}
}
type
PlayBotDb
struct
{
type
PlayBotDb
struct
{
...
@@ -45,7 +48,24 @@ func NewPlayBotDb(dbParams DbParams) (Db, error) {
...
@@ -45,7 +48,24 @@ func NewPlayBotDb(dbParams DbParams) (Db, error) {
return
&
PlayBotDb
{
db
},
nil
return
&
PlayBotDb
{
db
},
nil
}
}
func
(
pdb
*
PlayBotDb
)
Insert
(
value
interface
{})
error
{
func
(
pdb
*
PlayBotDb
)
Insert
(
value
interface
{})
Db
{
pdb
.
db
.
Create
(
value
)
return
&
PlayBotDb
{
return
nil
pdb
.
db
.
Create
(
value
),
}
}
func
(
pdb
*
PlayBotDb
)
Error
()
error
{
return
pdb
.
db
.
Error
}
func
(
pdb
*
PlayBotDb
)
First
(
value
interface
{})
Db
{
return
&
PlayBotDb
{
pdb
.
db
.
First
(
value
),
}
}
func
(
pdb
*
PlayBotDb
)
Where
(
value
interface
{})
Db
{
return
&
PlayBotDb
{
pdb
.
db
.
Where
(
value
),
}
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
bot/post.go
+
6
−
5
Voir le fichier @
9a79d575
...
@@ -7,11 +7,12 @@ import (
...
@@ -7,11 +7,12 @@ import (
)
)
type
Post
struct
{
type
Post
struct
{
Id
int
Id
int
Date
time
.
Time
Date
time
.
Time
Author
string
`gorm:"column:sender_irc"`
Author
string
`gorm:"column:sender_irc"`
Source
string
`gorm:"column:chan"`
Source
string
`gorm:"column:chan"`
Content
*
site
.
Content
Content
*
site
.
Content
ContentId
int
`gorm:"column:content"`
}
}
func
(
Post
)
TableName
()
string
{
func
(
Post
)
TableName
()
string
{
...
...
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