Documentation ¶
Index ¶
- type CSVFile
- type ContentType
- type Exchange
- type File
- type GoogleDriveConverter
- type ImportInfo
- type ImportStatus
- type Meta
- func (meta *Meta) GetFieldName() string
- func (meta *Meta) GetMetas() []resource.Metaor
- func (meta *Meta) GetName() string
- func (meta *Meta) GetResource() resource.Resourcer
- func (meta *Meta) GetSetter() ...
- func (meta *Meta) GetValuer() func(interface{}, *qor.Context) interface{}
- func (meta *Meta) HasPermission(mode roles.PermissionMode, context *qor.Context) bool
- func (m *Meta) Set(field string, val interface{}) *Meta
- type Resource
- type XLSXFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CSVFile ¶
type CSVFile struct {
// contains filtered or unexported fields
}
func (*CSVFile) TotalLines ¶
type ContentType ¶
type ContentType string
const ( ExcelContentType ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" CSVContentType ContentType = "text/csv" )
type Exchange ¶
type Exchange struct { Resource *Resource StopOnError bool JobThrottle int StatusThrottle int NormalizeHeaders func(f File) []string DataStartAt int }
type GoogleDriveConverter ¶
type GoogleDriveConverter struct {
// contains filtered or unexported fields
}
func NewGoogleDriveConverter ¶
func NewGoogleDriveConverter(clientEmail, keyFilePath string) (gdc *GoogleDriveConverter, err error)
How to create a google api service account: https://developers.google.com/drive/web/service-accounts About google-api-go-client: https://code.google.com/p/google-api-go-client/wiki/GettingStarted
The contents of your RSA private key or your PEM file that contains a private key. If you have a p12 file instead, you can use `openssl` to export the private key into a pem file. $ openssl pkcs12 -in key.p12 -out key.pem -nodes It only supports PEM containers with no passphrase. More explanations, see: http://godoc.org/github.com/golang/oauth2
func NewGoogleDriveConverterByJSONKey ¶
func NewGoogleDriveConverterByJSONKey(filename string) (gdc *GoogleDriveConverter, err error)
NewGoogleDriveConverterByJSONKey will accept a json key file downloaded from google project and return a GoogleDriveConverter. Built for convinence.
func (*GoogleDriveConverter) Convert ¶
func (gdc *GoogleDriveConverter) Convert(path string, from, to ContentType) (r io.Reader, err error)
type ImportInfo ¶
type ImportStatus ¶
type ImportStatus struct { LineNum int MetaValues *resource.MetaValues Errors []error }
type Meta ¶
type Meta struct { Name string // Alias string Label string // Type string Valuer func(interface{}, *qor.Context) interface{} Setter func(resource interface{}, metaValue *resource.MetaValue, context *qor.Context) Metas []resource.Metaor Resource resource.Resourcer // Collection interface{} // GetCollection func(interface{}, *qor.Context) [][]string Permission *roles.Permission Optional bool AliasHeaders []string // contains filtered or unexported fields }
func (*Meta) GetFieldName ¶
func (*Meta) GetResource ¶
func (*Meta) HasPermission ¶
type Resource ¶
type Resource struct { *resource.Resource Metas map[string]*Meta // TODO: replace it with a slice AutoCreate bool MultiDelimiter string HasSequentialColumns bool HeadersInOrder []string }
func NewResource ¶
func NewResource(val interface{}) *Resource
func (*Resource) CallFinder ¶
type XLSXFile ¶
type XLSXFile struct {
// contains filtered or unexported fields
}
XLSXFile only support xlsx format. It's a very weak feature. Recommend using GoogleDriveConverter to convert excel file instead.
func NewXLSXFile ¶
func NewXLSXFileZipReader ¶
func NewXLSXFileZipReader(zr *zip.ReadCloser) (nxf *XLSXFile, err error)
func (*XLSXFile) TotalLines ¶
Click to show internal directories.
Click to hide internal directories.