filter

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	// SELECT * FROM @@table WHERE id = @id LIMIT 1
	GetByID(id uint64) gen.T
	// SELECT * FROM @@table
	// {{where}}
	//   {{if val != ""}}
	//     {{if strings.HasPrefix(val, "%") && strings.HasSuffix(val, "%")}}
	//       @@col LIKE concat('%', TRIM(BOTH '%' FROM @val), '%')
	//     {{else if strings.HasPrefix(val, "%")}}
	//       @@col LIKE concat('%', TRIM(BOTH '%' FROM @val))
	//     {{else if strings.HasSuffix(val, "%")}}
	//       @@col LIKE concat(TRIM(BOTH '%' FROM @val), '%')
	//     {{else}}
	//       @@col = @val
	//     {{end}}
	//   {{end}}
	// {{end}}
	// LIMIT 1
	GetByCol(col, val string) gen.T
	// SELECT * FROM @@table
	// {{if len(cols) == len(vals)}}
	//  {{where}}
	//     {{for i, col := range cols}}
	//       {{for j, val := range vals}}
	//         {{if i == j}}
	//           {{if val != ""}}
	//             {{if strings.HasPrefix(val, "%") && strings.HasSuffix(val, "%")}}
	//               @@col LIKE concat('%', TRIM(BOTH '%' FROM @val), '%') AND
	//             {{else if strings.HasPrefix(val, "%")}}
	//               @@col LIKE concat('%', TRIM(BOTH '%' FROM @val)) AND
	//             {{else if strings.HasSuffix(val, "%")}}
	//               @@col LIKE concat(TRIM(BOTH '%' FROM @val), '%') AND
	//             {{else}}
	//               @@col = @val AND
	//             {{end}}
	//           {{end}}
	//         {{end}}
	//       {{end}}
	//     {{end}}
	//   {{end}}
	// {{end}}
	// LIMIT 1
	GetByCols(cols, vals []string) gen.T
	// SELECT * FROM @@table
	// {{where}}
	//   {{if val != ""}}
	//     {{if strings.HasPrefix(val, "%") && strings.HasSuffix(val, "%")}}
	//       @@col LIKE concat('%', TRIM(BOTH '%' FROM @val), '%')
	//     {{else if strings.HasPrefix(val, "%")}}
	//       @@col LIKE concat('%', TRIM(BOTH '%' FROM @val))
	//     {{else if strings.HasSuffix(val, "%")}}
	//       @@col LIKE concat(TRIM(BOTH '%' FROM @val), '%')
	//     {{else}}
	//       @@col = @val
	//     {{end}}
	//   {{end}}
	// {{end}}
	FindByCol(col, val string) []gen.T
	// SELECT * FROM @@table
	// {{if len(cols) == len(vals)}}
	//  {{where}}
	//     {{for i, col := range cols}}
	//       {{for j, val := range vals}}
	//         {{if i == j}}
	//           {{if val != ""}}
	//             {{if strings.HasPrefix(val, "%") && strings.HasSuffix(val, "%")}}
	//               @@col LIKE concat('%', TRIM(BOTH '%' FROM @val), '%') AND
	//             {{else if strings.HasPrefix(val, "%")}}
	//               @@col LIKE concat('%', TRIM(BOTH '%' FROM @val)) AND
	//             {{else if strings.HasSuffix(val, "%")}}
	//               @@col LIKE concat(TRIM(BOTH '%' FROM @val), '%') AND
	//             {{else}}
	//               @@col = @val AND
	//             {{end}}
	//           {{end}}
	//         {{end}}
	//       {{end}}
	//     {{end}}
	//   {{end}}
	// {{end}}
	FindByCols(cols, vals []string) []gen.T
}

Jump to

Keyboard shortcuts

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