Slug

Slug provides an easy way to create pretty URLs for your model.

Usage

If the source field called Name, Use *WithSlug which is NameWithSlug as the slug field name, the field type should be slug.Slug. Then the pretty URL would be derived from Name automatically on editing.

type User struct {
	gorm.Model
	Name            string
	NameWithSlug    slug.Slug
}