columns

package
v6.103.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name      string
	Writeable bool
	Readable  bool
	SelectSQL string
}

Column represents a SQL table column.

func (Column) QuotedUpdateString

func (c Column) QuotedUpdateString(quoter quoter) string

QuotedUpdateString returns quoted the SQL statement to UPDATE the column.

func (*Column) SetSelectSQL

func (c *Column) SetSelectSQL(s string)

SetSelectSQL sets a custom SELECT statement for the column.

func (Column) UpdateString

func (c Column) UpdateString() string

UpdateString returns the SQL statement to UPDATE the column.

type Columns

type Columns struct {
	Cols map[string]*Column

	TableName  string
	TableAlias string
	IDField    string
	// contains filtered or unexported fields
}

Columns represent a list of columns, related to a given table.

func ForStruct

func ForStruct(s interface{}, tableName, idField string) (columns Columns)

ForStruct returns a Columns instance for the struct passed in.

func ForStructWithAlias

func ForStructWithAlias(s interface{}, tableName, tableAlias, idField string) (columns Columns)

ForStructWithAlias returns a Columns instance for the struct passed in. If the tableAlias is not empty, it will be used.

func NewColumns

func NewColumns(tableName, idField string) Columns

NewColumns constructs a list of columns for a given table name.

func NewColumnsWithAlias

func NewColumnsWithAlias(tableName, tableAlias, idField string) Columns

NewColumnsWithAlias constructs a list of columns for a given table name, using a given alias for the table.

func (*Columns) Add

func (c *Columns) Add(names ...string) []*Column

Add a column to the list.

func (Columns) QuotedString

func (c Columns) QuotedString(quoter quoter) string

QuotedString gives the columns list quoted with the given quoter function.

func (Columns) QuotedUpdateString

func (c Columns) QuotedUpdateString(quoter quoter) string

QuotedUpdateString returns the quoted SQL column list part of the UPDATE query.

func (Columns) Readable

func (c Columns) Readable() *ReadableColumns

Readable gets a list of the readable columns from the column list.

func (*Columns) Remove

func (c *Columns) Remove(names ...string)

Remove a column from the list.

func (Columns) String

func (c Columns) String() string

func (Columns) SymbolizedString

func (c Columns) SymbolizedString() string

SymbolizedString returns a list of tokens (:token) to bind a value to an INSERT query.

func (Columns) Writeable

func (c Columns) Writeable() *WriteableColumns

Writeable gets a list of the writeable columns from the column list.

type ReadableColumns

type ReadableColumns struct {
	Columns
}

ReadableColumns represents a list of columns Pop is allowed to read.

func (ReadableColumns) SelectString

func (c ReadableColumns) SelectString() string

SelectString returns the SQL column list part of the SELECT query.

type Tag

type Tag struct {
	Value string
	Name  string
}

Tag represents a field tag defined exclusively for pop package.

func (Tag) Empty

func (t Tag) Empty() bool

Empty validates if this pop tag is empty.

func (Tag) Ignored

func (t Tag) Ignored() bool

Ignored validates if this pop tag is ignored. assuming an ignored tag as "-".

type Tags

type Tags []Tag

Tags is a group of pop tags defined in just one model field.

func TagsFor

func TagsFor(field reflect.StructField) Tags

TagsFor is a function which returns all tags defined in model field.

func (Tags) Find

func (t Tags) Find(name string) Tag

Find find for a specific tag with the name passed as a param. returns an empty Tag in case it is not found.

type WriteableColumns

type WriteableColumns struct {
	Columns
}

WriteableColumns represents a list of columns Pop is allowed to write.

func (WriteableColumns) UpdateString

func (c WriteableColumns) UpdateString() string

UpdateString returns the SQL column list part of the UPDATE query.

Jump to

Keyboard shortcuts

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