gorm

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 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

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

CreateModelConstraints creates model constraints

func CreateModelsConstraints

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

CreateModelsConstraints creates models constraints

func HasConstraint

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

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

JoinField struct

func NewJoinField

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

NewJoinField creates a new join field

type ModelConstraints

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

ModelConstraints struct

func NewModelConstraints

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