model

package
v0.0.0-...-932f57c Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasPrimaryFields

func HasPrimaryFields(s Schema) bool

Types

type Field

type Field interface {
	Name() string
	DBName() string
	QuotedDBName() string
	FullDBName() string
	QuotedFullDBName() string
}

type Fields

type Fields []Field

func (Fields) DBNames

func (f Fields) DBNames() (s []string)

func (Fields) First

func (f Fields) First() Field

func (Fields) FullDBNames

func (f Fields) FullDBNames() (s []string)

func (Fields) Len

func (f Fields) Len() int

func (Fields) Names

func (f Fields) Names() (s []string)

func (Fields) QuotedDBNames

func (f Fields) QuotedDBNames() (s []string)

func (Fields) QuotedFullDBNames

func (f Fields) QuotedFullDBNames() (s []string)

type ID

type ID struct {
	Values []any
	Fields Fields
	Schema Schema
}

func (ID) Clone

func (id ID) Clone() ID

func (ID) GetValue

func (id ID) GetValue(fieldName string) interface{}

func (ID) IsZero

func (id ID) IsZero() bool

func (ID) Related

func (s ID) Related(schema Schema, fieldName ...string) ID

func (ID) SetTo

func (id ID) SetTo(obj interface{})

func (ID) String

func (id ID) String() string

func (ID) StringValues

func (id ID) StringValues() (s []string)

func (ID) Value

func (s ID) Value() any

func (ID) WithField

func (id ID) WithField(fieldName string, value any) ID

func (ID) Without

func (id ID) Without(fieldName ...string) ID

type IDSlice

type IDSlice []ID

func (IDSlice) Last

func (s IDSlice) Last() ID

func (IDSlice) LastValues

func (s IDSlice) LastValues() []any

func (IDSlice) Len

func (s IDSlice) Len() int

func (*IDSlice) Pop

func (s *IDSlice) Pop() ID

func (*IDSlice) PopValues

func (s *IDSlice) PopValues() []any

func (IDSlice) String

func (s IDSlice) String() string

func (IDSlice) Values

func (s IDSlice) Values() (values [][]any)

type Schema

type Schema interface {
	Model() any
	Table() string
	QuotedTable() string
	Fields() Fields
	PrimaryFields() Fields
	FieldsByName(f ...string) Fields
	FieldByName(name string) Field
}

type SingleField

type SingleField string

func (SingleField) DBName

func (s SingleField) DBName() string

func (SingleField) FullDBName

func (s SingleField) FullDBName() string

func (SingleField) Name

func (s SingleField) Name() string

func (SingleField) QuotedDBName

func (s SingleField) QuotedDBName() string

func (SingleField) QuotedFullDBName

func (s SingleField) QuotedFullDBName() string

Jump to

Keyboard shortcuts

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