relationtype

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Unlicense Imports: 1 Imported by: 0

Documentation

Overview

Package relationtype has all the relation types that can be used with this ORM

Index

Constants

This section is empty.

Variables

View Source
var RelationTypeNames = []string{
	OneToOne:   "one to one",
	OneToMany:  "one to many",
	ManyToOne:  "many to one",
	ManyToMany: "many to many",
}

Functions

This section is empty.

Types

type RelationType

type RelationType int
const (
	// Every *one* country can have only *one* capital and
	// every one capital can only have one country
	// A 1 <----> 1 B
	OneToOne RelationType = iota
	// Every *one* user has *many* addresses (OneToMany) and
	// each one of those addresses can only have one user (ManyToOne)
	// A 1 <----> n B
	// B n <----> 1 B
	// OneToMany is the inverse of ManyToOne
	// The "One" part specifies which of the two models
	// is only allowed to be owned once by the other one
	OneToMany
	// *Many* addresses can have only *one* user each (ManyToOne) and
	// each of those users can have any number of addresses (OneToMany)
	// A n <----> 1 B
	// B 1 <----> n A
	// ManyToOne is the inverse of OneToMany
	ManyToOne

	// *Many* orders can have *many* products and
	// any product can belong to any order
	ManyToMany
)

func FromString

func FromString(rts string) RelationType

func (RelationType) IsToMany added in v0.6.0

func (rt RelationType) IsToMany() bool

func (RelationType) IsToOne added in v0.6.0

func (rt RelationType) IsToOne() bool

func (RelationType) String

func (rt RelationType) String() string

Jump to

Keyboard shortcuts

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