slug

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 13 Imported by: 0

README

Slug

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

Usage

Use slug.Slug as your field type with the same name as the benefactor field, from which the slug's value should be dynamically derived, and prepended with WithSlug, for example:


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

License

Released under the MIT License.

Documentation

Index

Constants

View Source
const (
	I18nSlugKey i18n.ModuleKey = "I18nSlugKey"
)

Variables

View Source
var Messages_en_US = &Messages{
	Sync: "Auto sync from %s",
}
View Source
var Messages_zh_CN = &Messages{
	Sync: "从%s自动同步",
}

Functions

func Configure

func Configure(b *presets.Builder, mb *presets.ModelBuilder)

func SlugEditingComponentFunc

func SlugEditingComponentFunc(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) h.HTMLComponent

func SlugEditingSetterFunc

func SlugEditingSetterFunc(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) (err error)

Types

type Messages

type Messages struct {
	Sync string
}

type Slug

type Slug string

Jump to

Keyboard shortcuts

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