sqljointype

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JoinTwoTableSyntaxFormat
	//
	// References:
	//  - JOINSyntax        : refers to the enum sql-syntax
	//  - Join Sample       : https://www.w3schools.com/sql/sql_join.asp
	//  - Inner Join Sample : https://www.w3schools.com/sql/sql_join_inner.asp
	//  - Joins Diagrams    : https://prnt.sc/26guaad
	//  - Code Samples      : https://prnt.sc/26gub4k
	JoinTwoTableSyntaxFormat = "%s %s ON %s = %s" // JOINSyntax, LeftTable, LeftTableWithField, RightTableWithField

)

Variables

View Source
var (
	Ranges = [...]string{
		Default:   "Default",
		Invalid:   "Invalid",
		Join:      "Join",
		Inner:     "Inner",
		Left:      "Left",
		Right:     "Right",
		FullOuter: "FullOuter",
		Cross:     "Cross",
	}

	InnerJoinMap = map[Variant]bool{
		Default: true,
		Join:    true,
		Inner:   true,
	}

	OuterJoinMap = map[Variant]bool{
		Left:      true,
		Right:     true,
		FullOuter: true,
	}

	SqlSyntax = [...]string{
		Default:   "JOIN",
		Invalid:   "",
		Join:      "JOIN",
		Inner:     "INNER JOIN",
		Left:      "LEFT JOIN",
		Right:     "RIGHT JOIN",
		FullOuter: "FULL OUTER JOIN",
		Cross:     "CROSS JOIN",
	}

	RangesMap = map[string]Variant{
		"Default":   Default,
		"Invalid":   Invalid,
		"":          Invalid,
		"Join":      Join,
		"Inner":     Inner,
		"Left":      Left,
		"Right":     Right,
		"FullOuter": FullOuter,
		"Cross":     Cross,
	}

	BasicEnumImpl = enumimpl.New.BasicByte.UsingTypeSlice(
		coredynamic.TypeName(Left),
		Ranges[:])
)

Functions

func Compile added in v0.0.2

func Compile(clause JoinerClause) string

func RangesInvalidErr

func RangesInvalidErr() error

Types

type JoinerClause added in v0.0.2

type JoinerClause struct {
	JoinType Variant
	Left     TableWithColumn
	Right    TableWithColumn
}

JoinerClause

Compile using JoinTwoTableSyntaxFormat

References:

func (JoinerClause) Clone added in v0.0.2

func (it JoinerClause) Clone() JoinerClause

func (JoinerClause) Compile added in v0.0.2

func (it JoinerClause) Compile() string

Compile

generate to string using JoinTwoTableSyntaxFormat

References:

func (JoinerClause) SetLeftClone added in v0.0.2

func (it JoinerClause) SetLeftClone(
	left TableWithColumn,
) JoinerClause

func (JoinerClause) SetRightClone added in v0.0.2

func (it JoinerClause) SetRightClone(
	right TableWithColumn,
) JoinerClause

func (JoinerClause) String added in v0.0.2

func (it JoinerClause) String() string

String

generate to string using JoinTwoTableSyntaxFormat

References:

type TableWithColumn added in v0.0.2

type TableWithColumn struct {
	TableName, ColumnName string
}

func (TableWithColumn) Clone added in v0.0.2

func (it TableWithColumn) Clone() TableWithColumn

func (TableWithColumn) TableWithField added in v0.0.2

func (it TableWithColumn) TableWithField() string

TableWithField

Table.FieldName

type Variant

type Variant byte
const (
	Default Variant = iota
	Invalid
	Join
	Inner
	Left
	Right
	FullOuter // Reference : https://www.w3schools.com/sql/sql_join_full.asp
	Cross
)

func Max added in v0.1.3

func Max() Variant

func Min added in v0.1.3

func Min() Variant

func (Variant) AllNameValues added in v0.0.4

func (it Variant) AllNameValues() []string

func (*Variant) AsBasicByteEnumContractsBinder

func (it *Variant) AsBasicByteEnumContractsBinder() enuminf.BasicByteEnumContractsBinder

func (Variant) AsBasicEnumContractsBinder

func (it Variant) AsBasicEnumContractsBinder() enuminf.BasicEnumContractsBinder

func (*Variant) AsJsonContractsBinder

func (it *Variant) AsJsonContractsBinder() corejson.JsonContractsBinder

func (*Variant) AsJsonMarshaller

func (it *Variant) AsJsonMarshaller() corejson.JsonMarshaller

func (*Variant) AsJsoner

func (it *Variant) AsJsoner() corejson.Jsoner

func (Variant) Compile added in v0.0.2

func (it Variant) Compile(left, right TableWithColumn) string

Compile

References:

func (Variant) EnumType added in v0.0.4

func (it Variant) EnumType() enuminf.EnumTyper

func (Variant) Format added in v0.0.4

func (it Variant) Format(format string) (compiled string)

func (Variant) IntegerEnumRanges added in v0.0.4

func (it Variant) IntegerEnumRanges() []int

func (Variant) IsAnyNamesOf added in v0.0.4

func (it Variant) IsAnyNamesOf(names ...string) bool

func (Variant) IsAnyOf

func (it Variant) IsAnyOf(anyOfItems ...Variant) bool

func (Variant) IsAnyValuesEqual added in v0.0.4

func (it Variant) IsAnyValuesEqual(anyByteValues ...byte) bool

func (Variant) IsByteValueEqual added in v0.0.4

func (it Variant) IsByteValueEqual(value byte) bool

func (Variant) IsCross

func (it Variant) IsCross() bool

func (Variant) IsFullOuter

func (it Variant) IsFullOuter() bool

func (Variant) IsInnerJoinLogically

func (it Variant) IsInnerJoinLogically() bool

func (Variant) IsInvalid

func (it Variant) IsInvalid() bool

func (Variant) IsJoin

func (it Variant) IsJoin() bool

func (Variant) IsLeft

func (it Variant) IsLeft() bool

func (Variant) IsLeftOuter

func (it Variant) IsLeftOuter() bool

func (Variant) IsNameEqual added in v0.0.4

func (it Variant) IsNameEqual(name string) bool

func (Variant) IsOuterJoinLogically

func (it Variant) IsOuterJoinLogically() bool

func (Variant) IsRight

func (it Variant) IsRight() bool

func (Variant) IsRightOuter

func (it Variant) IsRightOuter() bool

func (Variant) IsValid added in v0.0.4

func (it Variant) IsValid() bool

func (Variant) IsValidLogically

func (it Variant) IsValidLogically() bool

func (Variant) IsValueEqual added in v0.0.4

func (it Variant) IsValueEqual(value byte) bool

func (Variant) JoinClause added in v0.0.2

func (it Variant) JoinClause(left, right TableWithColumn) JoinerClause

func (Variant) Json

func (it Variant) Json() corejson.Result

func (*Variant) JsonParseSelfInject

func (it *Variant) JsonParseSelfInject(jsonResult *corejson.Result) error

func (Variant) JsonPtr

func (it Variant) JsonPtr() *corejson.Result

func (Variant) MarshalJSON

func (it Variant) MarshalJSON() ([]byte, error)

func (Variant) MaxByte

func (it Variant) MaxByte() byte

func (Variant) MaxInt added in v0.0.4

func (it Variant) MaxInt() int

func (Variant) MaxValueString added in v0.0.4

func (it Variant) MaxValueString() string

func (Variant) MinByte

func (it Variant) MinByte() byte

func (Variant) MinInt added in v0.0.4

func (it Variant) MinInt() int

func (Variant) MinMaxAny added in v0.1.3

func (it Variant) MinMaxAny() (min, max interface{})

func (Variant) MinValueString added in v0.0.4

func (it Variant) MinValueString() string

func (Variant) Name

func (it Variant) Name() string

func (Variant) NameValue

func (it Variant) NameValue() string

func (Variant) OnlySupportedErr added in v0.0.4

func (it Variant) OnlySupportedErr(names ...string) error

func (Variant) OnlySupportedMsgErr added in v0.0.4

func (it Variant) OnlySupportedMsgErr(message string, names ...string) error

func (Variant) RangeNamesCsv

func (it Variant) RangeNamesCsv() string

func (Variant) RangesByte

func (it Variant) RangesByte() []byte

func (Variant) RangesDynamicMap added in v0.0.4

func (it Variant) RangesDynamicMap() map[string]interface{}

func (Variant) String

func (it Variant) String() string

func (Variant) ToNumberString

func (it Variant) ToNumberString() string

func (Variant) ToPtr

func (it Variant) ToPtr() *Variant

func (*Variant) ToSimple

func (it *Variant) ToSimple() Variant

func (Variant) ToSqlName

func (it Variant) ToSqlName() string

func (Variant) TypeName

func (it Variant) TypeName() string

func (*Variant) UnmarshalJSON

func (it *Variant) UnmarshalJSON(data []byte) error

func (Variant) UnmarshallEnumToValue

func (it Variant) UnmarshallEnumToValue(
	jsonUnmarshallingValue []byte,
) (byte, error)

func (Variant) Value

func (it Variant) Value() byte

func (Variant) ValueByte

func (it Variant) ValueByte() byte

func (Variant) ValueInt

func (it Variant) ValueInt() int

func (Variant) ValueInt16 added in v0.0.4

func (it Variant) ValueInt16() int16

func (Variant) ValueInt32 added in v0.0.4

func (it Variant) ValueInt32() int32

func (Variant) ValueInt8 added in v0.0.4

func (it Variant) ValueInt8() int8

func (Variant) ValueString added in v0.0.4

func (it Variant) ValueString() string

func (Variant) ValueUInt16 added in v0.0.4

func (it Variant) ValueUInt16() uint16

Jump to

Keyboard shortcuts

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