dto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Certificates = &certificatesService{}
)
View Source
var (
	Validate *validator.Validate
)

Functions

func Setup

func Setup(cfg *Config) (err error)

Setup initializes the database connection

Types

type Certificate

type Certificate struct {
	Model
	Raw          string    `json:"raw"`
	SerialNumber string    `json:"serialNumber"`
	ExpiresAt    time.Time `json:"expiresAt"`
	// user metadata
	Username     string `json:"username"`
	DeviceSerial string `json:"deviceSerial"`
}

type Config

type Config struct {
	URL         string `yaml:"url" bind:"required"`
	Driver      string `yaml:"driver" bind:"required"`
	Automigrate bool   `yaml:"automigrate"`
}

Config holds database configuration

type Model

type Model struct {
	ID        uuid.UUID  `json:"-" gorm:"primary_key"`
	CreatedAt time.Time  `json:"-"`
	UpdatedAt time.Time  `json:"-"`
	DeletedAt *time.Time `json:"-"`
}

Model is a base model for db interaction

func (*Model) BeforeCreate

func (*Model) BeforeCreate(scope *gorm.Scope) error

BeforeCreate implements UUID generation for new resources

Jump to

Keyboard shortcuts

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