database

package module
v0.0.0-...-e5e9728 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 3 Imported by: 0

README

database

database library to store the models and database controllers

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

DB the databse when conneted

Functions

func Connect

func Connect()

Connect function to make database connection. After connect the first action to perform is migrations execution, that will make table alteration when it's necessary

Types

type Card

type Card struct {
	gorm.Model
	Value int  `json:"value"`
	Game  Game `json:"game"`
}

Card data struct to map the Card table

type Game

type Game struct {
	gorm.Model
	UUID string `json:"uuid"`
	Name string `json:"name"`
}

Game data struct to map the Game table

type Match

type Match struct {
	gorm.Model
	Date time.Time `json:"date"`
	Game Game      `json:"game"`
}

Match data struct to map the Match table

type Move

type Move struct {
	gorm.Model
	Card   Card   `json:"card"`
	Match  Match  `json:"match"`
	Player Player `json:"player"`
}

Move data struct to map the Move table

type Player

type Player struct {
	gorm.Model
	Name  string `json:"name"`
	Email string `json:"email"`
	Game  Game   `json:"game"`
}

Player data struct to map the Player table

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL