Documentation
¶
Overview ¶
Package sql3util implements SQLite utilities.
Index ¶
- func NamedArg(arg string) (key, val string)
- func ParseBool(s string) (b, ok bool)
- func ParseFloat(s string) (f float64, ok bool)
- func ParseTimeShift(s string) (years, months, days int, duration time.Duration, ok bool)
- func Unquote(val string) string
- func ValidPageSize(s int) bool
- type Affinity
- type Column
- type ConflictClause
- type ConstraintType
- type FKAction
- type FKDefType
- type ForeignKey
- type GenType
- type IdxColumn
- type OrderClause
- type StatementType
- type Table
- type TableConstraint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NamedArg ¶
NamedArg splits an named arg into a key and value, around an equals sign. Spaces are trimmed around both key and value.
func ParseFloat ¶ added in v0.30.4
ParseFloat parses a decimal floating point number.
func ParseTimeShift ¶ added in v0.30.4
ParseTimeShift parses a time shift modifier, also the output of timediff.
func ValidPageSize ¶
ValidPageSize returns true if s is a valid page size.
Types ¶
type Affinity ¶ added in v0.30.5
type Affinity byte
Affinity is the type affinity of a column.
https://sqlite.org/datatype3.html#type_affinity
func GetAffinity ¶ added in v0.30.5
GetAffinity determines the affinity of a column by the declared type of the column.
https://sqlite.org/datatype3.html#determination_of_column_affinity
type Column ¶
type Column struct {
Name string
Type string
Length string
ConstraintName string
Comment string
IsPrimaryKey bool
IsAutoIncrement bool
IsNotNull bool
IsUnique bool
PKOrder OrderClause
PKConflictClause ConflictClause
NotNullConflictClause ConflictClause
UniqueConflictClause ConflictClause
CheckExpr string
DefaultExpr string
CollateName string
ForeignKeyClause *ForeignKey
GeneratedExpr string
GeneratedType GenType
}
Column holds metadata about a column.
type ConflictClause ¶
type ConflictClause uint32
const ( CONFLICT_NONE ConflictClause = iota CONFLICT_ROLLBACK CONFLICT_ABORT CONFLICT_FAIL CONFLICT_IGNORE CONFLICT_REPLACE )
type ConstraintType ¶ added in v0.30.5
type ConstraintType uint32
const ( TABLECONSTRAINT_PRIMARYKEY ConstraintType = iota TABLECONSTRAINT_UNIQUE TABLECONSTRAINT_CHECK TABLECONSTRAINT_FOREIGNKEY )
type ForeignKey ¶
type ForeignKey struct {
Table string
ColumnNames []string
OnDelete FKAction
OnUpdate FKAction
Match string
Deferrable FKDefType
}
ForeignKey holds metadata about a foreign key constraint.
type IdxColumn ¶ added in v0.30.5
type IdxColumn struct {
Name string
CollateName string
Order OrderClause
}
IdxColumn holds metadata about an indexed column.
type OrderClause ¶
type OrderClause uint32
const ( ORDER_NONE OrderClause = iota ORDER_ASC ORDER_DESC )
type StatementType ¶
type StatementType uint32
const ( CREATE_UNKNOWN StatementType = iota CREATE_TABLE ALTER_RENAME_TABLE ALTER_RENAME_COLUMN ALTER_ADD_COLUMN ALTER_DROP_COLUMN )
type Table ¶
type Table struct {
Name string
Schema string
Comment string
IsTemporary bool
IsIfNotExists bool
IsWithoutRowID bool
IsStrict bool
Columns []Column
Constraints []TableConstraint
Type StatementType
CurrentName string
NewName string
}
Table holds metadata about a table.
func ParseTable ¶
ParseTable parses a CREATE or ALTER TABLE command.
type TableConstraint ¶ added in v0.30.5
type TableConstraint struct {
Type ConstraintType
Name string
// Type is TABLECONSTRAINT_PRIMARYKEY or TABLECONSTRAINT_UNIQUE
IndexedColumns []IdxColumn
ConflictClause ConflictClause
IsAutoIncrement bool
// Type is TABLECONSTRAINT_CHECK
CheckExpr string
// Type is TABLECONSTRAINT_FOREIGNKEY
ForeignKeyNames []string
ForeignKeyClause *ForeignKey
}
TableConstraint holds metadata about a table key constraint.