Files
crimson-vault/internal/models/client.go
T
2025-05-28 17:44:05 +01:00

25 lines
482 B
Go

package models
import "gorm.io/gorm"
type Client struct {
gorm.Model
Name string
Country string
Phone string
}
func (wrapper *DBWrapper) MigrateClients() {
wrapper.db.AutoMigrate(&Client{})
}
func (wrapper *DBWrapper) CreateClient(name string, country string, phone string) {
wrapper.db.Create(&Client{Name: name, Country: country, Phone: phone})
}
func (wrapper *DBWrapper) GetClient(id int) (Client) {
var client Client
wrapper.db.First(&client, id)
return client
}