models

package
v0.0.0-...-6802e93 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: GPL-3.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIKeys apikeys
View Source
var (
	Sources sources
)
View Source
var SwaggerDefinition = map[string]interface{}{
	"Pagination": map[string]interface{}{
		"type":     "object",
		"required": []string{"records", "pages"},
		"properties": map[string]interface{}{
			"records": map[string]interface{}{
				"type": "integer",
			},
			"pages": map[string]interface{}{
				"type": "integer",
			},
			"cursor": map[string]interface{}{
				"type": "object",
				"properties": map[string]interface{}{
					"prev": map[string]interface{}{
						"type":   "string",
						"format": "uri",
					},
					"next": map[string]interface{}{
						"type":   "string",
						"format": "uri",
					},
				},
			},
		},
	},
}
View Source
var SwaggerDefinitionTmpl = map[string]interface{}{
	"type": "object",
	"properties": map[string]interface{}{
		"paging": map[string]interface{}{
			"$ref": "#/definitions/Pagination",
		},
	},
}
View Source
var Users users

Functions

func NewData

func NewData(source *Source, p map[string]interface{}) (*data, error)

Types

type Data

type Data struct {
	Paging struct {
		Records uint64 `json:"records" xml:"records"`
		Pages   uint   `json:"pages" xml:"pages"`
		Cursor  struct {
			Prev string `json:"prev,omitempty" yaml:"prev,omitempty"`
			Next string `json:"next,omitempty" yaml:"next,omitempty"`
		} `json:"cursor,omitempty" yaml:"cursor,omitempty"`
	} `json:"paging"`
	Data []map[string]string `json:"data" xml:"data"`
}

type Model

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

func (*Model) Add

func (m *Model) Add(d interface{}) (int64, error)

func (*Model) Delete

func (m *Model) Delete(q interface{}) error

func (*Model) Get

func (m *Model) Get(q interface{}) (d map[string]interface{}, err error)

func (*Model) List

func (m *Model) List() (d []map[string]interface{}, err error)

func (*Model) Update

func (m *Model) Update(q interface{}, d interface{}) error

type Source

type Source struct {
	ID          int64    `bson:"_id" db:"id,omitempty" json:"id"`
	Title       string   `db:"title" json:"title"`
	Slug        string   `db:"slug" json:"slug"`
	Description string   `db:"description" json:"description"`
	Params      params   `db:"params" json:"params"`
	Status      bool     `db:"status" json:"status"`
	Tables      []string `db:"-" json:"tables,omitempty"`
}

func (*Source) Collections

func (m *Source) Collections() error

func (*Source) Connect

func (m *Source) Connect() (db.Session, error)

func (*Source) Endpoint

func (m *Source) Endpoint(name string) (e map[string]interface{}, err error)

func (*Source) Schema

func (m *Source) Schema(h string) (s Swagger)

type Swagger

type Swagger struct {
	Swagger string `json:"swagger"`
	Info    struct {
		Title       string `json:"title,omitempty" yaml:"title,omitempty"`
		Description string `json:"description,omitempty" yaml:"description,omitempty"`
		Version     string `json:"version"`
	} `json:"info"`
	Host                string                            `json:"host"`
	BasePath            string                            `json:"basePath" yaml:"basePath"`
	Consumes            []string                          `json:"consumes"`
	Produces            []string                          `json:"produces"`
	Tags                []SwaggerTag                      `json:"tags"`
	SecurityDefinitions *map[string]interface{}           `json:"securityDefinitions,omitempty" yaml:"securityDefinitions,omitempty"`
	Paths               map[string]map[string]SwaggerPath `json:"paths"`
	Definitions         map[string]interface{}            `json:"definitions"`
}

type SwaggerPath

type SwaggerPath struct {
	Tags        []string               `json:"tags"`
	Summary     string                 `json:"summary"`
	Description string                 `json:"description,omitempty" yaml:"description,omitempty"`
	OperationID string                 `json:"operationId" yaml:"operationId"`
	Security    *[]map[string][]string `json:"security,omitempty" yaml:"security,omitempty"`
	// Consumes *[]string `json:"consumes,omitempty" yaml:"consumes,omitempty"`
	// Produces *[]string `json:"produces,omitempty" yaml:"produces,omitempty"`
	Parameters []map[string]interface{}          `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Responses  map[string]map[string]interface{} `json:"responses"`
}

type SwaggerTag

type SwaggerTag struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type User

type User struct {
	ID       int      `bson:"_id" json:"id,omitempty" db:"id"`
	Name     string   `json:"name" db:"name"`
	Email    string   `json:"email" db:"email"`
	Username string   `json:"username" db:"username"`
	Password string   `db:"password,omitempty" json:"password,omitempty"`
	Admin    bool     `json:"admin" db:"admin"`
	APIKeys  []string `db:"-" bson:"-" json:"api_keys,omitempty"`
}

Jump to

Keyboard shortcuts

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