Merge branch 'feature/database-schema' into main
Ajouter dbschema et dbstruct Contiennent respective le schéma de base de donnée et l'objet dbstruct.Presence, pour en manipuler les données
This commit is contained in:
commit
525012eee6
2 changed files with 25 additions and 0 deletions
11
dbschema/dbschema.go
Normal file
11
dbschema/dbschema.go
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
// Package dbschema defines the database schema for the application
|
||||||
|
package dbschema
|
||||||
|
|
||||||
|
const Schema string = `
|
||||||
|
CREATE TABLE IF NOT EXISTS presences (
|
||||||
|
id VARCHAR(7) PRIMARY KEY NOT NULL,
|
||||||
|
at TIMESTAMP NOT NULL,
|
||||||
|
name VARCHAR(50) NOT NULL,
|
||||||
|
programme_id NOT NULL
|
||||||
|
);
|
||||||
|
`
|
14
dbstruct/dbstruct.go
Normal file
14
dbstruct/dbstruct.go
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
Package dbstruct provides struct types used to represent data declared in
|
||||||
|
dbschema and marshalled / unmarshalled by dbclient
|
||||||
|
*/
|
||||||
|
package dbstruct
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type Presence struct {
|
||||||
|
ID string `db:"id" json:"id" csv:"id"`
|
||||||
|
At *time.Time `db:"at" json:"at" csv:"at"`
|
||||||
|
Name string `db:"name" json:"name" csv:"name"`
|
||||||
|
ProgrammeID string `db:"programme_id" json:"programme_id" csv:"programme_id"`
|
||||||
|
}
|
Loading…
Reference in a new issue