models

package
v0.0.0-...-02e5558 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB(conn string, driver string, name string) error

InitDB regists the orm db driver and regists to the database

func QueryReposList

func QueryReposList() ([]string, error)

QueryReposList returns the repos list

func QueryTagsList

func QueryTagsList(reponame string, proto string, protoVerion string) ([]string, error)

QueryTagsList returns the tags list by 'reponame, proto and proto version'

Types

type ContainerImage

type ContainerImage struct {
	ID     int    `orm:"column(id);auto"`
	Tag    string `orm:"column(tag);size(255);null"`
	Size   int64  `orm:"column(size);null"`
	RepoID int    `orm:"column(repo_id);null"`

	// docker, oci, rkt...
	Proto        string `orm:"column(proto);size(15);null"`
	ProtoVersion string `orm:"column(proto_version);size(15);null"`
}

ContainerImage defines the container image struct.

func AddImage

func AddImage(reponame string, tags string, proto string, protoVerion string) (*ContainerImage, error)

AddImage adds an image to the database. If the target repo is not exist, it will create a repo. TODO: lots of rollback

func QueryImage

func QueryImage(repoid int, tag string, proto string, protoVerion string) (*ContainerImage, error)

QueryImage returns a container image by 'repoid, tag, proto and proto version'

type ContainerRepo

type ContainerRepo struct {
	ID          int    `orm:"column(id);auto"`
	Name        string `orm:"unique;column(name);size(255);null"`
	Star        int    `orm:"column(star);null"`
	DownloadNum int    `orm:"column(download_num);null"`
	Description string `orm:"column(description);null"`
}

ContainerRepo defines the container repo struct, will support dockerv2, ociv1.

func AddRepo

func AddRepo(reponame string) (*ContainerRepo, error)

AddRepo adds a repo to the database

Jump to

Keyboard shortcuts

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