standards

package
v0.0.0-...-bf0f985 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2020 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BBStandard

type BBStandard struct {
	Standard `gorm:"embedded;embeddedPrefix:bb_"`
	// Thread definition (if needed)
	ThreadID int            `json:"-"`
	Thread   ThreadStandard `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	// IsThreaded : true if  it's a threaded bottom bracket
	IsThreaded bool
	// IsPressFit : true if it's a pressfit bottom bracket
	// (can't be true with isThreaded)
	IsPressFit bool
	// the inside width of the shell in mm
	ShellWidth float32
	// External diameter in mm
	ExternalWidth float32
}

BBStandard will define the bottom bracket standard

func GetAll

func GetAll(db *gorm.DB, page string, perPage string) (standards []BBStandard)

GetAll will returns al the standards

func (*BBStandard) Delete

func (s *BBStandard) Delete(db *gorm.DB, values url.Values, id int) (int, interface{})

Delete BB standard will remove the BB sTandard struct in the database

func (BBStandard) Get

func (BBStandard) Get(db *gorm.DB, values url.Values, id int) (int, interface{})

Get BBStandard return the requests BB Standards

func (BBStandard) Post

func (BBStandard) Post(db *gorm.DB, values url.Values, request *http.Request, id int, adj string) (int, interface{})

Post will save the BBStandard

func (BBStandard) Put

func (BBStandard) Put(db *gorm.DB, values url.Values, body io.ReadCloser) (int, interface{})

Put updates BBStandard

type Standard

type Standard struct {
	// add basic ID/Created@/Updated@/Delete@ through Gorm
	gorm.Model
	// TODO : this is a embded struct on other structs,
	//  find a way to create indexes on each struct that embed this struct
	Name        string `gorm:"uniqueIndex:standard_uniqueness"`
	Country     string
	Code        string `gorm:"uniqueIndex:standard_uniqueness"`
	Type        string `gorm:"uniqueIndex:standard_uniqueness"`
	Description string
}

Standard define the generic common Standard properties

type StandardInt

type StandardInt interface {
	GetName() string
	GetCountry() string
	GetCode() string
	GetType() string
	Get() string
}

StandardInt interface define all the method that a standard need to have to be a real standard struct

type ThreadStandard

type ThreadStandard struct {
	gorm.Model
	ThreadPerInch float32
	Diameter      float32
	Orientation   string
}

ThreadStandard defines the the standard of a thread used todo : https://en.wikipedia.org/wiki/Screw_thread

Jump to

Keyboard shortcuts

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