package schema

Import Path
	github.com/uptrace/bun/schema (on go.dev)

Dependency Relation
	imports 21 packages, and imported by 4 packages


Package-Level Type Names (total 28, in which 22 are exported)
/* sort exporteds by: | */
( T) AfterScan(context.Context) error
func Appender(typ reflect.Type, custom CustomAppender) AppenderFunc func FieldAppender(dialect Dialect, field *Field) AppenderFunc func PtrAppender(fn AppenderFunc) AppenderFunc func Dialect.Appender(typ reflect.Type) AppenderFunc func Dialect.FieldAppender(field *Field) AppenderFunc func github.com/uptrace/bun/dialect/mysqldialect.(*Dialect).Appender(typ reflect.Type) AppenderFunc func github.com/uptrace/bun/dialect/mysqldialect.(*Dialect).FieldAppender(field *Field) AppenderFunc func github.com/uptrace/bun/dialect/pgdialect.(*Dialect).Appender(typ reflect.Type) AppenderFunc func github.com/uptrace/bun/dialect/pgdialect.(*Dialect).FieldAppender(field *Field) AppenderFunc func github.com/uptrace/bun/dialect/sqlitedialect.(*Dialect).Appender(typ reflect.Type) AppenderFunc func github.com/uptrace/bun/dialect/sqlitedialect.(*Dialect).FieldAppender(field *Field) AppenderFunc func PtrAppender(fn AppenderFunc) AppenderFunc
type BaseModel (struct)
( T) BeforeScan(context.Context) error
( T) AppendColumns(fmter Formatter, b []byte) ([]byte, error) *github.com/uptrace/bun.ValuesQuery
func Append(fmter Formatter, b []byte, v interface{}, custom CustomAppender) []byte func Appender(typ reflect.Type, custom CustomAppender) AppenderFunc
( T) Append(fmter Formatter, b []byte, v interface{}) []byte ( T) Appender(typ reflect.Type) AppenderFunc ( T) Features() feature.Feature ( T) FieldAppender(field *Field) AppenderFunc ( T) IdentQuote() byte ( T) Init(db *sql.DB) ( T) Name() dialect.Name ( T) OnTable(table *Table) ( T) Scanner(typ reflect.Type) ScannerFunc ( T) Tables() *Tables *github.com/uptrace/bun/dialect/mysqldialect.Dialect *github.com/uptrace/bun/dialect/pgdialect.Dialect *github.com/uptrace/bun/dialect/sqlitedialect.Dialect func Formatter.Dialect() Dialect func (*Table).Dialect() Dialect func github.com/uptrace/bun.(*DB).Dialect() Dialect func FieldAppender(dialect Dialect, field *Field) AppenderFunc func FieldScanner(dialect Dialect, field *Field) ScannerFunc func NewFormatter(dialect Dialect) Formatter func NewTables(dialect Dialect) *Tables func github.com/uptrace/bun.NewDB(sqldb *sql.DB, dialect Dialect, opts ...bun.DBOption) *bun.DB
Append AppenderFunc AutoIncrement bool CreateTableSQLType string DiscoveredSQLType string // struct field name, e.g. Id Index []int IndirectType reflect.Type IsPK bool IsZero IsZeroerFunc // SQL name, .e.g. id NotNull bool NullZero bool OnDelete string OnUpdate string SQLDefault string // escaped SQL name, e.g. "id" Scan ScannerFunc StructField reflect.StructField Tag tagparser.Tag UserSQLType string (*T) AppendValue(fmter Formatter, b []byte, strct reflect.Value) []byte (*T) Clone() *Field (*T) HasZeroValue(v reflect.Value) bool (*T) ScanValue(strct reflect.Value, src interface{}) error (*T) ScanWithCheck(fv reflect.Value, src interface{}) error (*T) String() string (*T) Value(strct reflect.Value) reflect.Value *T : fmt.Stringer func (*Field).Clone() *Field func (*Table).Field(name string) (*Field, error) func FieldAppender(dialect Dialect, field *Field) AppenderFunc func FieldScanner(dialect Dialect, field *Field) ScannerFunc func Dialect.FieldAppender(field *Field) AppenderFunc func github.com/uptrace/bun/dialect/mysqldialect.(*Dialect).FieldAppender(field *Field) AppenderFunc func github.com/uptrace/bun/dialect/pgdialect.(*Dialect).FieldAppender(field *Field) AppenderFunc func github.com/uptrace/bun/dialect/sqlitedialect.(*Dialect).FieldAppender(field *Field) AppenderFunc
( T) AppendIdent(b []byte, ident string) []byte ( T) AppendQuery(dst []byte, query string, args ...interface{}) []byte ( T) AppendValue(b []byte, v reflect.Value) []byte ( T) Dialect() Dialect ( T) FormatQuery(query string, args ...interface{}) string ( T) HasFeature(feature feature.Feature) bool ( T) IdentQuote() byte ( T) IsNop() bool ( T) WithArg(arg NamedArgAppender) Formatter ( T) WithNamedArg(name string, value interface{}) Formatter func NewFormatter(dialect Dialect) Formatter func NewNopFormatter() Formatter func Formatter.WithArg(arg NamedArgAppender) Formatter func Formatter.WithNamedArg(name string, value interface{}) Formatter func github.com/uptrace/bun.(*DB).Formatter() Formatter func Append(fmter Formatter, b []byte, v interface{}, custom CustomAppender) []byte func AppendBoolValue(fmter Formatter, b []byte, v reflect.Value) []byte func AppendFloat32Value(fmter Formatter, b []byte, v reflect.Value) []byte func AppendFloat64Value(fmter Formatter, b []byte, v reflect.Value) []byte func AppendIntValue(fmter Formatter, b []byte, v reflect.Value) []byte func AppendJSONValue(fmter Formatter, b []byte, v reflect.Value) []byte func AppendQueryAppender(fmter Formatter, b []byte, app QueryAppender) []byte func AppendStringValue(fmter Formatter, b []byte, v reflect.Value) []byte func AppendUintValue(fmter Formatter, b []byte, v reflect.Value) []byte func ColumnsAppender.AppendColumns(fmter Formatter, b []byte) ([]byte, error) func Dialect.Append(fmter Formatter, b []byte, v interface{}) []byte func (*Field).AppendValue(fmter Formatter, b []byte, strct reflect.Value) []byte func Ident.AppendQuery(fmter Formatter, b []byte) ([]byte, error) func NamedArgAppender.AppendNamedArg(fmter Formatter, b []byte, name string) ([]byte, bool) func NullTime.AppendQuery(fmter Formatter, b []byte) ([]byte, error) func Query.AppendQuery(fmter Formatter, b []byte) ([]byte, error) func QueryAppender.AppendQuery(fmter Formatter, b []byte) ([]byte, error) func QueryWithArgs.AppendQuery(fmter Formatter, b []byte) ([]byte, error) func Safe.AppendQuery(fmter Formatter, b []byte) ([]byte, error) func (*Table).AppendNamedArg(fmter Formatter, b []byte, name string, strct reflect.Value) ([]byte, bool) func github.com/uptrace/bun.(*AddColumnQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*CreateIndexQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*CreateTableQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*DeleteQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*DropColumnQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*DropIndexQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*DropTableQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*InsertQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.InValues.AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*SelectQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*TruncateTableQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*UpdateQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*ValuesQuery).AppendColumns(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun.(*ValuesQuery).AppendNamedArg(fmter Formatter, b []byte, name string) ([]byte, bool) func github.com/uptrace/bun.(*ValuesQuery).AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) func github.com/uptrace/bun/dialect/mysqldialect.(*Dialect).Append(fmter Formatter, b []byte, v interface{}) []byte func github.com/uptrace/bun/dialect/pgdialect.(*ArrayValue).AppendQuery(fmter Formatter, b []byte) ([]byte, error) func github.com/uptrace/bun/dialect/pgdialect.(*Dialect).Append(fmter Formatter, b []byte, v interface{}) []byte func github.com/uptrace/bun/dialect/sqlitedialect.(*Dialect).Append(fmter Formatter, b []byte, v interface{}) []byte
Ident represents a SQL identifier, for example, table or column name. ( T) AppendQuery(fmter Formatter, b []byte) ([]byte, error) T : QueryAppender func github.com/uptrace/bun.(*UpdateQuery).FQN(name string) bun.Ident
( T) AppendNamedArg(fmter Formatter, b []byte, name string) ([]byte, bool) *github.com/uptrace/bun.AddColumnQuery *github.com/uptrace/bun.CreateIndexQuery *github.com/uptrace/bun.CreateTableQuery *github.com/uptrace/bun.DeleteQuery *github.com/uptrace/bun.DropColumnQuery *github.com/uptrace/bun.DropIndexQuery *github.com/uptrace/bun.DropTableQuery *github.com/uptrace/bun.InsertQuery *github.com/uptrace/bun.SelectQuery *github.com/uptrace/bun.TruncateTableQuery *github.com/uptrace/bun.UpdateQuery *github.com/uptrace/bun.ValuesQuery func Formatter.WithArg(arg NamedArgAppender) Formatter
NullTime is a time.Time wrapper that marshals zero time as JSON null and SQL NULL. Time time.Time Add returns the time t+d. AddDate returns the time corresponding to adding the given number of years, months, and days to t. For example, AddDate(-1, 2, 3) applied to January 1, 2011 returns March 4, 2010. AddDate normalizes its result in the same way that Date does, so, for example, adding one month to October 31 yields December 1, the normalized form for November 31. After reports whether the time instant t is after u. AppendFormat is like Format but appends the textual representation to b and returns the extended buffer. ( T) AppendQuery(fmter Formatter, b []byte) ([]byte, error) Before reports whether the time instant t is before u. Clock returns the hour, minute, and second within the day specified by t. Date returns the year, month, and day in which t occurs. Day returns the day of the month specified by t. Equal reports whether t and u represent the same time instant. Two times can be equal even if they are in different locations. For example, 6:00 +0200 and 4:00 UTC are Equal. See the documentation on the Time type for the pitfalls of using == with Time values; most code should use Equal instead. Format returns a textual representation of the time value formatted according to layout, which defines the format by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006 would be displayed if it were the value; it serves as an example of the desired output. The same display rules will then be applied to the time value. A fractional second is represented by adding a period and zeros to the end of the seconds section of layout string, as in "15:04:05.000" to format a time stamp with millisecond precision. Predefined layouts ANSIC, UnixDate, RFC3339 and others describe standard and convenient representations of the reference time. For more information about the formats and the definition of the reference time, see the documentation for ANSIC and the other constants defined by this package. GobDecode implements the gob.GobDecoder interface. GobEncode implements the gob.GobEncoder interface. Hour returns the hour within the day specified by t, in the range [0, 23]. ISOWeek returns the ISO 8601 year and week number in which t occurs. Week ranges from 1 to 53. Jan 01 to Jan 03 of year n might belong to week 52 or 53 of year n-1, and Dec 29 to Dec 31 might belong to week 1 of year n+1. In returns a copy of t representing the same time instant, but with the copy's location information set to loc for display purposes. In panics if loc is nil. IsZero reports whether t represents the zero time instant, January 1, year 1, 00:00:00 UTC. Local returns t with the location set to local time. Location returns the time zone information associated with t. MarshalBinary implements the encoding.BinaryMarshaler interface. ( T) MarshalJSON() ([]byte, error) MarshalText implements the encoding.TextMarshaler interface. The time is formatted in RFC 3339 format, with sub-second precision added if present. Minute returns the minute offset within the hour specified by t, in the range [0, 59]. Month returns the month of the year specified by t. Nanosecond returns the nanosecond offset within the second specified by t, in the range [0, 999999999]. Round returns the result of rounding t to the nearest multiple of d (since the zero time). The rounding behavior for halfway values is to round up. If d <= 0, Round returns t stripped of any monotonic clock reading but otherwise unchanged. Round operates on the time as an absolute duration since the zero time; it does not operate on the presentation form of the time. Thus, Round(Hour) may return a time with a non-zero minute, depending on the time's Location. (*T) Scan(src interface{}) error Second returns the second offset within the minute specified by t, in the range [0, 59]. String returns the time formatted using the format string "2006-01-02 15:04:05.999999999 -0700 MST" If the time has a monotonic clock reading, the returned string includes a final field "m=±<value>", where value is the monotonic clock reading formatted as a decimal number of seconds. The returned string is meant for debugging; for a stable serialized representation, use t.MarshalText, t.MarshalBinary, or t.Format with an explicit format string. Sub returns the duration t-u. If the result exceeds the maximum (or minimum) value that can be stored in a Duration, the maximum (or minimum) duration will be returned. To compute t-d for a duration d, use t.Add(-d). Truncate returns the result of rounding t down to a multiple of d (since the zero time). If d <= 0, Truncate returns t stripped of any monotonic clock reading but otherwise unchanged. Truncate operates on the time as an absolute duration since the zero time; it does not operate on the presentation form of the time. Thus, Truncate(Hour) may return a time with a non-zero minute, depending on the time's Location. UTC returns t with the location set to UTC. Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC. The result does not depend on the location associated with t. Unix-like operating systems often record time as a 32-bit count of seconds, but since the method here returns a 64-bit value it is valid for billions of years into the past or future. UnixNano returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC. The result is undefined if the Unix time in nanoseconds cannot be represented by an int64 (a date before the year 1678 or after 2262). Note that this means the result of calling UnixNano on the zero Time is undefined. The result does not depend on the location associated with t. UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. (*T) UnmarshalJSON(b []byte) error UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format. Weekday returns the day of the week specified by t. Year returns the year in which t occurs. YearDay returns the day of the year specified by t, in the range [1,365] for non-leap years, and [1,366] in leap years. Zone computes the time zone in effect at time t, returning the abbreviated name of the zone (such as "CET") and its offset in seconds east of UTC. T : QueryAppender *T : database/sql.Scanner T : encoding.BinaryMarshaler *T : encoding.BinaryUnmarshaler T : encoding.TextMarshaler *T : encoding.TextUnmarshaler T : encoding/json.Marshaler *T : encoding/json.Unmarshaler T : fmt.Stringer
( T) AppendQuery(fmter Formatter, b []byte) ([]byte, error) ( T) Operation() string *github.com/uptrace/bun.AddColumnQuery *github.com/uptrace/bun.CreateIndexQuery *github.com/uptrace/bun.CreateTableQuery *github.com/uptrace/bun.DeleteQuery *github.com/uptrace/bun.DropColumnQuery *github.com/uptrace/bun.DropIndexQuery *github.com/uptrace/bun.DropTableQuery *github.com/uptrace/bun.InsertQuery *github.com/uptrace/bun.SelectQuery *github.com/uptrace/bun.TruncateTableQuery *github.com/uptrace/bun.UpdateQuery *github.com/uptrace/bun.ValuesQuery T : QueryAppender
( T) AppendQuery(fmter Formatter, b []byte) ([]byte, error) Ident NullTime Query (interface) QueryWithArgs QueryWithSep Safe *github.com/uptrace/bun.AddColumnQuery *github.com/uptrace/bun.CreateIndexQuery *github.com/uptrace/bun.CreateTableQuery *github.com/uptrace/bun.DeleteQuery *github.com/uptrace/bun.DropColumnQuery *github.com/uptrace/bun.DropIndexQuery *github.com/uptrace/bun.DropTableQuery *github.com/uptrace/bun.InsertQuery github.com/uptrace/bun.InValues *github.com/uptrace/bun.SelectQuery *github.com/uptrace/bun.TruncateTableQuery *github.com/uptrace/bun.UpdateQuery *github.com/uptrace/bun.ValuesQuery *github.com/uptrace/bun/dialect/pgdialect.ArrayValue func AppendQueryAppender(fmter Formatter, b []byte, app QueryAppender) []byte func github.com/uptrace/bun.(*DeleteQuery).With(name string, query QueryAppender) *bun.DeleteQuery func github.com/uptrace/bun.(*InsertQuery).With(name string, query QueryAppender) *bun.InsertQuery func github.com/uptrace/bun.(*SelectQuery).With(name string, query QueryAppender) *bun.SelectQuery func github.com/uptrace/bun.(*UpdateQuery).With(name string, query QueryAppender) *bun.UpdateQuery
Args []interface{} Query string ( T) AppendQuery(fmter Formatter, b []byte) ([]byte, error) ( T) IsZero() bool T : QueryAppender func SafeQuery(query string, args []interface{}) QueryWithArgs func UnsafeIdent(ident string) QueryWithArgs
QueryWithArgs QueryWithArgs QueryWithArgs.Args []interface{} QueryWithArgs.Query string Sep string ( T) AppendQuery(fmter Formatter, b []byte) ([]byte, error) ( T) IsZero() bool T : QueryAppender func SafeQueryWithSep(query string, args []interface{}, sep string) QueryWithSep
BaseFields []*Field Field *Field JoinFields []*Field JoinTable *Table M2MBaseFields []*Field M2MJoinFields []*Field M2MTable *Table PolymorphicField *Field PolymorphicValue string Type int (*T) String() string *T : fmt.Stringer
Safe represents a safe SQL query. ( T) AppendQuery(fmter Formatter, b []byte) ([]byte, error) T : QueryAppender
func FieldScanner(dialect Dialect, field *Field) ScannerFunc func PtrScanner(fn ScannerFunc) ScannerFunc func Scanner(typ reflect.Type) ScannerFunc func Dialect.Scanner(typ reflect.Type) ScannerFunc func github.com/uptrace/bun/dialect/mysqldialect.(*Dialect).Scanner(typ reflect.Type) ScannerFunc func github.com/uptrace/bun/dialect/pgdialect.(*Dialect).Scanner(typ reflect.Type) ScannerFunc func github.com/uptrace/bun/dialect/sqlitedialect.(*Dialect).Scanner(typ reflect.Type) ScannerFunc func PtrScanner(fn ScannerFunc) ScannerFunc
Table represents a SQL table created from Go struct. Alias string DataFields []*Field FieldMap map[string]*Field // PKs + DataFields ModelName string Name string PKs []*Field Relations map[string]*Relation SQLAlias Safe SQLName Safe SQLNameForSelects Safe SoftDeleteField *Field Type reflect.Type TypeName string Unique map[string][]*Field UpdateSoftDeleteField func(fv reflect.Value, tm time.Time) error // struct pointer // reflect.Struct (*T) AppendNamedArg(fmter Formatter, b []byte, name string, strct reflect.Value) ([]byte, bool) (*T) CheckPKs() error (*T) Dialect() Dialect (*T) Field(name string) (*Field, error) (*T) HasAfterScanHook() bool (*T) HasBeforeScanHook() bool (*T) HasField(name string) bool (*T) String() string *T : fmt.Stringer func (*Tables).ByModel(name string) *Table func (*Tables).ByName(name string) *Table func (*Tables).Get(typ reflect.Type) *Table func (*Tables).Ref(typ reflect.Type) *Table func github.com/uptrace/bun.(*DB).Table(typ reflect.Type) *Table func Dialect.OnTable(table *Table) func github.com/uptrace/bun/dialect/mysqldialect.(*Dialect).OnTable(table *Table) func github.com/uptrace/bun/dialect/pgdialect.(*Dialect).OnTable(table *Table) func github.com/uptrace/bun/dialect/sqlitedialect.(*Dialect).OnTable(table *Table)
(*T) ByModel(name string) *Table (*T) ByName(name string) *Table (*T) Get(typ reflect.Type) *Table (*T) Ref(typ reflect.Type) *Table (*T) Register(models ...interface{}) func NewTables(dialect Dialect) *Tables func Dialect.Tables() *Tables func github.com/uptrace/bun/dialect/mysqldialect.(*Dialect).Tables() *Tables func github.com/uptrace/bun/dialect/pgdialect.(*Dialect).Tables() *Tables func github.com/uptrace/bun/dialect/sqlitedialect.(*Dialect).Tables() *Tables
Package-Level Functions (total 83, in which 23 are exported)
func Append(fmter Formatter, b []byte, v interface{}, custom CustomAppender) []byte
func FieldAppender(dialect Dialect, field *Field) AppenderFunc
func FieldScanner(dialect Dialect, field *Field) ScannerFunc
func NewTables(dialect Dialect) *Tables
func SafeQuery(query string, args []interface{}) QueryWithArgs
func SafeQueryWithSep(query string, args []interface{}, sep string) QueryWithSep
SetTableNameInflector overrides the default func that pluralizes model name to get table name, e.g. my_article becomes my_articles.
Package-Level Constants (total 7, in which 5 are exported)
const HasManyRelation = 3
const HasOneRelation = 1
const InvalidRelation = 0