go-admin: github.com/GoAdminGroup/go-admin/plugins/admin/modules/table Index | Files

package table

import "github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"

Index

Package Files

config.go default.go generators.go table.go

Constants

const (
    DefaultPrimaryKeyName = "id"
    DefaultConnectionName = "default"
)

func SetServices Uses

func SetServices(srv service.List)

type BaseTable Uses

type BaseTable struct {
    Info           *types.InfoPanel
    Form           *types.FormPanel
    Detail         *types.InfoPanel
    CanAdd         bool
    Editable       bool
    Deletable      bool
    Exportable     bool
    OnlyInfo       bool
    OnlyDetail     bool
    OnlyNewForm    bool
    OnlyUpdateForm bool
    PrimaryKey     PrimaryKey
}

func (*BaseTable) GetCanAdd Uses

func (base *BaseTable) GetCanAdd() bool

func (*BaseTable) GetDeletable Uses

func (base *BaseTable) GetDeletable() bool

func (*BaseTable) GetDetail Uses

func (base *BaseTable) GetDetail() *types.InfoPanel

func (*BaseTable) GetDetailFromInfo Uses

func (base *BaseTable) GetDetailFromInfo() *types.InfoPanel

func (*BaseTable) GetEditable Uses

func (base *BaseTable) GetEditable() bool

func (*BaseTable) GetExportable Uses

func (base *BaseTable) GetExportable() bool

func (*BaseTable) GetForm Uses

func (base *BaseTable) GetForm() *types.FormPanel

func (*BaseTable) GetInfo Uses

func (base *BaseTable) GetInfo() *types.InfoPanel

func (*BaseTable) GetOnlyDetail Uses

func (base *BaseTable) GetOnlyDetail() bool

func (*BaseTable) GetOnlyInfo Uses

func (base *BaseTable) GetOnlyInfo() bool

func (*BaseTable) GetOnlyNewForm Uses

func (base *BaseTable) GetOnlyNewForm() bool

func (*BaseTable) GetOnlyUpdateForm Uses

func (base *BaseTable) GetOnlyUpdateForm() bool

func (*BaseTable) GetPaginator Uses

func (base *BaseTable) GetPaginator(size int, params parameter.Parameters, extraHtml ...template.HTML) types.PaginatorAttribute

func (*BaseTable) GetPrimaryKey Uses

func (base *BaseTable) GetPrimaryKey() PrimaryKey

type Columns Uses

type Columns []string

type Config Uses

type Config struct {
    Driver         string
    Connection     string
    CanAdd         bool
    Editable       bool
    Deletable      bool
    Exportable     bool
    PrimaryKey     PrimaryKey
    SourceURL      string
    GetDataFun     GetDataFun
    OnlyInfo       bool
    OnlyNewForm    bool
    OnlyUpdateForm bool
    OnlyDetail     bool
}

func DefaultConfig Uses

func DefaultConfig() Config

func DefaultConfigWithDriver Uses

func DefaultConfigWithDriver(driver string) Config

func DefaultConfigWithDriverAndConnection Uses

func DefaultConfigWithDriverAndConnection(driver, conn string) Config

func (Config) SetCanAdd Uses

func (config Config) SetCanAdd(canAdd bool) Config

func (Config) SetConnection Uses

func (config Config) SetConnection(connection string) Config

func (Config) SetDeletable Uses

func (config Config) SetDeletable(deletable bool) Config

func (Config) SetEditable Uses

func (config Config) SetEditable(editable bool) Config

func (Config) SetExportable Uses

func (config Config) SetExportable(exportable bool) Config

func (Config) SetGetDataFun Uses

func (config Config) SetGetDataFun(fun GetDataFun) Config

func (Config) SetOnlyDetail Uses

func (config Config) SetOnlyDetail() Config

func (Config) SetOnlyInfo Uses

func (config Config) SetOnlyInfo() Config

func (Config) SetOnlyNewForm Uses

func (config Config) SetOnlyNewForm() Config

func (Config) SetOnlyUpdateForm Uses

func (config Config) SetOnlyUpdateForm() Config

func (Config) SetPrimaryKeyType Uses

func (config Config) SetPrimaryKeyType(typ string) Config

func (Config) SetSourceURL Uses

func (config Config) SetSourceURL(url string) Config

type DefaultTable Uses

type DefaultTable struct {
    *BaseTable
    // contains filtered or unexported fields
}

func (*DefaultTable) Copy Uses

func (tb *DefaultTable) Copy() Table

func (*DefaultTable) DeleteData Uses

func (tb *DefaultTable) DeleteData(id string) error

DeleteData delete data.

func (*DefaultTable) GetData Uses

func (tb *DefaultTable) GetData(params parameter.Parameters) (PanelInfo, error)

GetData query the data set.

func (*DefaultTable) GetDataWithId Uses

func (tb *DefaultTable) GetDataWithId(param parameter.Parameters) (FormInfo, error)

GetDataWithId query the single row of data.

func (*DefaultTable) GetDataWithIds Uses

func (tb *DefaultTable) GetDataWithIds(params parameter.Parameters) (PanelInfo, error)

GetDataWithIds query the data set.

func (*DefaultTable) GetNewForm Uses

func (tb *DefaultTable) GetNewForm() FormInfo

func (*DefaultTable) InsertData Uses

func (tb *DefaultTable) InsertData(dataList form.Values) error

InsertData insert data.

func (*DefaultTable) UpdateData Uses

func (tb *DefaultTable) UpdateData(dataList form.Values) error

UpdateData update data.

type FormInfo Uses

type FormInfo struct {
    FieldList         types.FormFields        `json:"field_list"`
    GroupFieldList    types.GroupFormFields   `json:"group_field_list"`
    GroupFieldHeaders types.GroupFieldHeaders `json:"group_field_headers"`
    Title             string                  `json:"title"`
    Description       string                  `json:"description"`
}

type Generator Uses

type Generator func(ctx *context.Context) Table

type GeneratorList Uses

type GeneratorList map[string]Generator

func (GeneratorList) Add Uses

func (g GeneratorList) Add(key string, gen Generator)

func (GeneratorList) Combine Uses

func (g GeneratorList) Combine(list GeneratorList) GeneratorList

func (GeneratorList) CombineAll Uses

func (g GeneratorList) CombineAll(gens []GeneratorList) GeneratorList

type GetDataFromURLRes Uses

type GetDataFromURLRes struct {
    Data []map[string]interface{}
    Size int
}

type GetDataFun Uses

type GetDataFun func(params parameter.Parameters) ([]map[string]interface{}, int)

type PanelInfo Uses

type PanelInfo struct {
    Thead          types.Thead              `json:"thead"`
    InfoList       types.InfoList           `json:"info_list"`
    FilterFormData types.FormFields         `json:"filter_form_data"`
    Paginator      types.PaginatorAttribute `json:"-"`
    Title          string                   `json:"title"`
    Description    string                   `json:"description"`
}

type PrimaryKey Uses

type PrimaryKey struct {
    Type db.DatabaseType
    Name string
}

type SystemTable Uses

type SystemTable struct {
    // contains filtered or unexported fields
}

func NewSystemTable Uses

func NewSystemTable(conn db.Connection, c *config.Config) *SystemTable

func (*SystemTable) GetGenerateForm Uses

func (s *SystemTable) GetGenerateForm(ctx *context.Context) (generateTool Table)

func (*SystemTable) GetManagerTable Uses

func (s *SystemTable) GetManagerTable(ctx *context.Context) (managerTable Table)

func (*SystemTable) GetMenuTable Uses

func (s *SystemTable) GetMenuTable(ctx *context.Context) (menuTable Table)

func (*SystemTable) GetNormalManagerTable Uses

func (s *SystemTable) GetNormalManagerTable(ctx *context.Context) (managerTable Table)

func (*SystemTable) GetOpTable Uses

func (s *SystemTable) GetOpTable(ctx *context.Context) (opTable Table)

func (*SystemTable) GetPermissionTable Uses

func (s *SystemTable) GetPermissionTable(ctx *context.Context) (permissionTable Table)

func (*SystemTable) GetRolesTable Uses

func (s *SystemTable) GetRolesTable(ctx *context.Context) (roleTable Table)

func (*SystemTable) GetSiteTable Uses

func (s *SystemTable) GetSiteTable(ctx *context.Context) (siteTable Table)

type Table Uses

type Table interface {
    GetInfo() *types.InfoPanel
    GetDetail() *types.InfoPanel
    GetDetailFromInfo() *types.InfoPanel
    GetForm() *types.FormPanel

    GetCanAdd() bool
    GetEditable() bool
    GetDeletable() bool
    GetExportable() bool

    GetPrimaryKey() PrimaryKey

    GetData(params parameter.Parameters) (PanelInfo, error)
    GetDataWithIds(params parameter.Parameters) (PanelInfo, error)
    GetDataWithId(params parameter.Parameters) (FormInfo, error)
    UpdateData(dataList form.Values) error
    InsertData(dataList form.Values) error
    DeleteData(pk string) error

    GetNewForm() FormInfo

    GetOnlyInfo() bool
    GetOnlyDetail() bool
    GetOnlyNewForm() bool
    GetOnlyUpdateForm() bool

    Copy() Table
}

func NewDefaultTable Uses

func NewDefaultTable(cfgs ...Config) Table

Package table imports 39 packages (graph) and is imported by 22 packages. Updated 2020-07-29. Refresh now. Tools for package owners.