gorm

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilJoinField        = errors.New("join field cannot be nil")
	ErrNilModelConstraints = errors.New("model constraints cannot be nil")
)

Functions

func CreateModelConstraints added in v0.3.4

func CreateModelConstraints(
	database *gorm.DB,
	modelConstraints *ModelConstraints,
) (err error)

CreateModelConstraints creates model constraints

func CreateModelsConstraints added in v0.3.4

func CreateModelsConstraints(
	database *gorm.DB,
	modelsConstraints []*ModelConstraints,
) error

CreateModelsConstraints creates models constraints

func HasConstraint added in v0.3.3

func HasConstraint(database *gorm.DB, model interface{}, name string) bool

HasConstraint checks if a constraint exists

func SetupJoinTable

func SetupJoinTable(
	database *gorm.DB,
	joinField *JoinField,
) error

SetupJoinTable setups the join table

func SetupJoinTables

func SetupJoinTables(
	database *gorm.DB,
	joinFields []*JoinField,
) (err error)

SetupJoinTables setups the join tables

Types

type JoinField added in v0.3.1

type JoinField struct {
	// contains filtered or unexported fields
}

JoinField struct

func NewJoinField added in v0.3.1

func NewJoinField(
	model interface{},
	field string,
	joinTable interface{},
) *JoinField

NewJoinField creates a new join field

type ModelConstraints added in v0.3.4

type ModelConstraints struct {
	// contains filtered or unexported fields
}

ModelConstraints struct

func NewModelConstraints added in v0.3.4

func NewModelConstraints(model interface{}, names ...string) *ModelConstraints

NewModelConstraints creates a new model constraints

Jump to

Keyboard shortcuts

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