model

package
v0.0.0-...-d831bb0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package model is responsible for the models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalID

func MarshalID(id hide.ID) graphql.Marshaler

MarshalID implements marshalling for IDs

func UnmarshalID

func UnmarshalID(v interface{}) (hide.ID, error)

UnmarshalID implements reverse marshalling for IDs from strings

Types

type CertRenewJob

type CertRenewJob struct {
	Model
	IntervalHours  int
	LastRun        time.Time
	NextRun        time.Time
	LoadbalancerID int
}

type Certificate

type Certificate struct {
	Model

	// The lego ACME certificate data
	certificate.Resource

	// The ID of the certificate in Hetzner
	HetznerID int `gorm:"UNIQUE_INDEX:idx_cert_h_id"`
}

type CreateCertJob

type CreateCertJob struct {
	Model
	LoadbalancerID    int
	ServiceListenPort int
	DomainNames       []string
}

type Model

type Model struct {
	ID        hide.ID `gorm:"type: bigserial;primary_key" json:"id"` // int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

Model Default model structure with hard deleting

func (Model) IDint

func (m Model) IDint() int64

IDint returns the ID as an int64

func (Model) IDstring

func (m Model) IDstring() string

IDstring returns the ID as a hash string

type PrivateKey

type PrivateKey struct {
	Model
	Name      string `gorm:"UNIQUE_INDEX:idx_private_key_name"`
	PublicKey string
	Key       string
}

type SoftDelete

type SoftDelete struct {
	ID        hide.ID `gorm:"type: bigserial;primary_key" json:"id"` // int64
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

SoftDelete Default model structure with soft deleting

func (SoftDelete) IDint

func (m SoftDelete) IDint() int64

IDint returns the ID as an int64

func (SoftDelete) IDstring

func (m SoftDelete) IDstring() string

IDstring returns the ID as a hash string

type User

type User struct {
	SoftDelete
	Username string `gorm:"UNIQUE_INDEX:idx_username"`
	Password string
}

User model

Jump to

Keyboard shortcuts

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