views

package
v0.19.771 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisableViewsKey string = "disable_views_key"

Functions

func CustomViewName

func CustomViewName(db *gorm.DB, obj any, name string) string

func DefaultTableName

func DefaultTableName(db *gorm.DB, obj any, appendStr string) string

DefaultTableName returns the default table name for an object, appending the provided string. This should be used when scopes.WithDisableViews is applied to the query.

func DefaultViewName

func DefaultViewName(db *gorm.DB, obj any, version int) string

func NewViewsPlugin

func NewViewsPlugin(models []interface{}) *viewsPlugin

ViewsPlugin is a plugin that enables turning on a view for specific models. This will overwrite the table name on query/preload to add the _view suffix, and use the straight table name for everything else.

func TableOrViewName

func TableOrViewName(db *gorm.DB, obj ViewModel, appendStr string) string

TableOrViewName returns the table or view name for an object, appending the provided string.

Types

type ViewModel

type ViewModel interface {
	UseView() bool
	ViewVersion() string
}

Jump to

Keyboard shortcuts

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