model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateModel

func CreateModel(opts *Options) (db *gorm.DB)

CreateModel new way of creating a schema

Types

type Installed

type Installed struct {
	gorm.Model
	ID       uint   `gorm:"primaryKey;not null"`
	Handle   string `gorm:"index:,unique;index:idx_installed_handle_origin_url,unique"`
	Template string
	Origin   string `gorm:"index:idx_installed_handle_origin_url,unique"`
	URL      string `gorm:"index:idx_installed_handle_origin_url,unique"`
	VcsRef   string
	Desc     string
	Time     time.Time
}

Installed a table of installed templates

type Options

type Options struct {
	File string
}

Options options create model

type Repo

type Repo struct {
	gorm.Model
	ID       uint `gorm:"primaryKey;not null"`
	Name     string
	URL      string `gorm:"index:,unique"`
	Desc     string
	Template []Template `gorm:"many2many:repo_template"`
}

Repo a set of templates

type Sync

type Sync struct {
	gorm.Model
	ID         uint      `gorm:"primaryKey;not null"`
	Key        string    `gorm:"index:,unique"`
	LastUpdate time.Time `gorm:"index;column:lastupdate"`
}

Sync last sync times

type Template

type Template struct {
	gorm.Model
	ID       uint `gorm:"primaryKey;not null"`
	Name     string
	URL      string `gorm:"index:,unique"`
	Desc     string
	Repo     []Repo `gorm:"many2many:repo_template"`
	Versions []Versions
}

Template a template definition

type Versions

type Versions struct {
	gorm.Model
	ID         uint     `gorm:"primaryKey;not null"`
	Version    string   `gorm:"index:idx_version_template,unique"`
	TemplateID uint     `gorm:"index:idx_version_template,unique"`
	Template   Template `gorm:"foreignKey:TemplateID"`
}

Versions template versions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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