Documentation ¶
Index ¶
- type Cell
- type Config
- type Container
- type Meta
- type Progress
- type Resource
- func (res *Resource) Export(container Container, context *qor.Context, callbacks ...func(Progress) error) error
- func (res *Resource) Export2(container Container, context *qor.Context, db *gorm.DB, ...) error
- func (res *Resource) GetMeta(name string) *Meta
- func (res *Resource) GetMetas([]string) []resource.Metaor
- func (res *Resource) Import(container Container, context *qor.Context, callbacks ...func(Progress) error) error
- func (res *Resource) Meta(meta *Meta) *Meta
- type Rows
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
Cell is a data cell, which including its data and error that happened when importing/exporting data
type Config ¶
type Config struct { // PrimaryField that used as primary field when searching resource from database PrimaryField string // Permission defined permission Permission *roles.Permission // WithoutHeader no header in the data file WithoutHeader bool DisableTransaction bool }
Config is exchange resource config
type Container ¶
type Container interface { NewReader(*Resource, *qor.Context) (Rows, error) NewWriter(*Resource, *qor.Context) (Writer, error) }
Container is an interface, any exporting/importing backends needs to implement this
type Meta ¶
type Meta struct { resource.Meta Name string Header string Valuer func(interface{}, *qor.Context) interface{} Setter func(resource interface{}, metaValue *resource.MetaValue, context *qor.Context) Permission *roles.Permission // contains filtered or unexported fields }
Meta defines importable/exportable fields
func (*Meta) GetResource ¶
GetResource get its resource
type Resource ¶
Resource defined an exchange resource, which includes importing/exporting fields definitions
func NewResource ¶
NewResource new exchange Resource
func (*Resource) Export ¶
func (res *Resource) Export(container Container, context *qor.Context, callbacks ...func(Progress) error) error
Export used export data from a exchange Resource
product.Export(csv.New("products.csv"), context)
func (*Resource) Export2 ¶
func (res *Resource) Export2(container Container, context *qor.Context, db *gorm.DB, callbacks ...func(Progress) error) error
Export used export data from a exchange Resource
product.Export(csv.New("products.csv"), context)
Click to show internal directories.
Click to hide internal directories.