Skip to content

Support escaping double quotes in struct tags #7600

@trungnt2910

Description

@trungnt2910

Describe the feature

Support escaping double quotes in struct tags.

Motivation

I have the following object and want to do a PostgreSQL full text search index on the column Name:

type Object struct {
	Key uuid.UUID `gorm:"primaryKey;type:uuid;default:gen_random_uuid()"`
	Name string `gorm:"not null"`
}

In SQL this would be:

CREATE INDEX idx_Object_Name ON "Object" USING GIN (to_tsvector('english', "Name"));

To do this in a GORM struct tag, I need to be able to put to_tsvector('english', "Name") with double quotes as the expression parameter. However, this doesn't seem to be supported or at least documented.

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions