slug

package module
v0.0.0-...-545ed2e Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: MIT Imports: 8 Imported by: 18

README

Slug

Slug provides an easy way to create a pretty URL, a.k.a. Search Engine Friendly (SEF) URL, for your model.

GoDoc

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:

import (
  "github.com/jinzhu/gorm"
  "github.com/qor/slug"
)

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

Then in the QOR Admin interface, you will see a slug field.

License

Released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Slug

type Slug struct {
	Slug string
}

Slug is a scanner, could be used as field type, then this field could be used as slug field

func (Slug) ConfigureQorMeta

func (Slug) ConfigureQorMeta(meta resource.Metaor)

ConfigureQorMeta configure slug for qor admin

func (*Slug) Scan

func (slug *Slug) Scan(value interface{}) error

Scan scan value into Slug

func (Slug) Value

func (slug Slug) Value() (driver.Value, error)

Value get slug's Value

Jump to

Keyboard shortcuts

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