model

package
v0.0.0-...-d0dead0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateModels

func MigrateModels()

MigrateModels: Use gorm to make database.Database necessary migrations.

Types

type Function

type Function struct {
	gorm.Model
	Name     string `gorm:"size:255;not null" json:"name"`
	Path     string `gorm:"size:255;not null;unique" json:"path"`
	ModuleID uint
}

func ListFunctions

func ListFunctions(module *Module) (functions []Function, err error)

ListFunctions: Return list of all Function from database.Database with associated Module ID..

func (*Function) Delete

func (f *Function) Delete() (*Function, error)

Delete: remove Module from database.Database

func (*Function) FindById

func (f *Function) FindById() (functions []Function, err error)

FindById: Search for given Function ID in database.Database with associated Module ID.

func (*Function) FindByName

func (f *Function) FindByName(module *Module) (functions []Function, err error)

FindByName: Search for given Function.Name in database.Database with associated Module ID.

func (*Function) FindByPath

func (f *Function) FindByPath(module *Module) (functions []Function, err error)

FindByPath: Search for given Function.Path in database.Database with associated Module ID.

func (*Function) Save

func (f *Function) Save(module *Module) (*Function, error)

Save: create Function into database.Database with associated Module

func (*Function) Update

func (f *Function) Update() (*Function, error)

Update: update Function from database.Database

type Module

type Module struct {
	gorm.Model
	Name      string `gorm:"size:255;not null" json:"name"`
	Path      string `gorm:"size:255;not null;unique" json:"path"`
	ProjectID uint
	Functions []Function `json:"functions"`
	Types     []Type     `json:"types"`
}

Module: Typedef for Module model.

func ListModules

func ListModules(project *Project) (modules []Module, err error)

ListModules: Return list of all Module from database.Database with associated Project ID..

func (*Module) Delete

func (m *Module) Delete() (*Module, error)

Delete: remove Module from database.Database

func (*Module) FindById

func (m *Module) FindById() (modules []Module, err error)

FindById: Search for given Module ID in database.Database with associated Module ID.

func (*Module) FindByName

func (m *Module) FindByName(project *Project) (modules []Module, err error)

FindByName: Search for given Module.Name in database.Database with associated Project ID.

func (*Module) FindByPath

func (m *Module) FindByPath() (modules []Module, err error)

FindByPath: Search for given Module.Path in database.Database with associated Module Path.

func (*Module) Save

func (m *Module) Save(project *Project) (*Module, error)

Save: create Module into database.Database with associated Project

func (*Module) Update

func (m *Module) Update() (*Module, error)

Update: update Module from database.Database

type Project

type Project struct {
	gorm.Model          // gorm.Model:
	Name       string   `gorm:"size:255;not null" json:"name"`        // Name: name of the Project
	Path       string   `gorm:"size:255;not null;unique" json:"path"` // Path: Path of the Project
	Modules    []Module `json:"modules"`                              // Modules: List of Project's related Module
	Todos      []Todo   `json:"todo"`                                 // Todos: List of Project's related Todo
}

Project: Typedef for Project model in database.Database

func ListProjects

func ListProjects() (projects []Project, err error)

ListProjects: Return list of all Project from database.Database

func (*Project) Delete

func (p *Project) Delete() (*Project, error)

Delete: remove Project from database.Database

func (*Project) FindById

func (p *Project) FindById() (*Project, error)

FindById: Search for list of Project in database.Database with Project ID

func (*Project) FindByName

func (p *Project) FindByName() (projects []Project, err error)

FindByName: Search for list of Project in database.Database with Project.Name

func (*Project) FindByPath

func (p *Project) FindByPath() (*Project, error)

FindByPath: Search for list of Project in database.Database with Project.Path

func (*Project) Save

func (p *Project) Save() (*Project, error)

Save: create Project into database.Database

func (*Project) Update

func (p *Project) Update() (*Project, error)

Update: update given Project from database.Database

type Todo

type Todo struct {
	gorm.Model
	Name string `gorm:"size:255;not null" json:"name"`
	Path string `gorm:"size:255;not null" json:"path"`
}

func (*Todo) Delete

func (t *Todo) Delete(db *database.Database) (*Todo, error)

func (*Todo) Save

func (t *Todo) Save(db *database.Database) (*Todo, error)

func (*Todo) Update

func (t *Todo) Update(db *database.Database) (*Todo, error)

type Type

type Type struct {
	gorm.Model
	Name string `gorm:"size:255;not null;unique" json:"name"`
	Path string `gorm:"size:255;not null;unique" json:"path"`
}

func (*Type) Delete

func (t *Type) Delete(db *database.Database) (*Type, error)

func (*Type) Save

func (t *Type) Save(db *database.Database) (*Type, error)

func (*Type) Update

func (t *Type) Update(db *database.Database) (*Type, error)

Jump to

Keyboard shortcuts

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