Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates a new instance of the plugin that can be registered in gorm. Without any settings, all queries will be LIKE-d.
Example ¶
db, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{}) _ = db.Use(New()) _ = db.Use(New(WithCharacter("*"))) _ = db.Use(New(TaggedOnly())) _ = db.Use(New(SettingOnly()))
Output:
Types ¶
type Option ¶
type Option func(like *gormLike)
Option can be given to the New() method to tweak its behaviour
func SettingOnly ¶ added in v0.0.3
func SettingOnly() Option
SettingOnly makes it so that only queries with the setting 'gormlike' set to true can be turned into LIKE queries. This can be configured using db.Set("gormlike", true) on the query.
func TaggedOnly ¶ added in v0.0.1
func TaggedOnly() Option
TaggedOnly makes it so that only fields with the tag `gormlike` can be turned into LIKE queries, useful if you don't want every field to be LIKE-able.
func WithCharacter ¶
WithCharacter allows you to specify a replacement character for the % in the LIKE queries
Click to show internal directories.
Click to hide internal directories.