model

package
v0.0.0-...-47a5c7a Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	NodeType     Node   `json:"node_type"`
	NodeName     string `json:"node_name"`
	Path         string `json:"path"`
	LibPath      string `json:"lib_path"`
	Mode         MODE   `json:"mode"`
	Port         int    `json:"port"`
	SecretKey    string `json:"secret_key"`
	DB           DB     `json:"db"`
	DBPath       string `json:"db_path"`
	DBName       string `json:"db_name"`
	DBHost       string `json:"db_host"`
	DBPort       int    `json:"db_port"`
	DBUser       string `json:"db_user"`
	DBPass       string `json:"db_pass"`
	DBSsl        string `json:"db_ssl"`
	RabbitMq     bool   `json:"-"`
	RabbitMqHost string `json:"rabbitmq_host"`
	RabbitMqPort int    `json:"rabbitmq_port"`
	RabbitMqUser string `json:"rabbitmq_user"`
	RabbitMqPass string `json:"rabbitmq_pass"`
	Redis        bool   `json:"-"`
	RedisHost    string `json:"redis_host"`
	RedisPort    int    `json:"redis_port"`
	RedisPass    string `json:"redis_pass"`
	RedisDB      int    `json:"redis_db"`
	ChannelName  string `json:"channel_name"`
	Versioning   bool   `json:"versioning"`
	Scheduler    string `json:"scheduler"`
}

Config Application config structure

type DB

type DB string

DB enum type

const Postgres DB = "postgres"

Postgres Enum

const Unknown DB = "unknown"

Unknown enum. This enum just test mode

type Dir

type Dir struct {
	Path    string      `json:"path"`
	Name    string      `json:"name"`
	Mode    interface{} `json:"mode"`
	Size    int64       `json:"size"`
	ModTime time.Time   `json:"mod_time"`
}

Dir lib path dir info structure

type JobType

type JobType string

JobType received message type

const (
	// NewRelease job type
	NewRelease JobType = "new_release"
	// Start job type
	Start JobType = "start"
	// Restart job type
	Restart JobType = "restart"
	// Shutdown job type
	Shutdown JobType = "shutdown"
	// Other job type
	Other JobType = "other"
)

type LoginRequest

type LoginRequest struct {
	ID       string `json:"id" validate:"required"`
	Password string `json:"password" validate:"required"`
}

LoginRequest api login request structure

type LoginResponse

type LoginResponse struct {
	PassphraseID int64  `json:"passphrase_id"`
	UserID       int64  `json:"user_id"`
	Passphrase   string `json:"passphrase"`
}

LoginResponse api login success response

type MODE

type MODE string

MODE type for application

const Dev MODE = "dev"

Dev Development mode enum

const Prod MODE = "prod"

Prod Production model enum

const Test MODE = "test"

Test mode enum

type Model

type Model interface {
	ToJSON() string
	Validate() (map[string]string, error)
}

Model structure interface

type Node

type Node string

Node type for worker

const (
	// Worker node type
	Worker Node = "worker"
	// Master node type
	Master Node = "master"
)

type Pagination

type Pagination struct {
	Model
	Limit      int `validate:"lte=40"`
	Offset     int64
	OrderBy    string `validate:"oneof=asc desc"`
	OrderField string
}

Pagination request pagination field parser

func NewPagination

func NewPagination() Pagination

NewPagination generate pagination struct with default values

func (Pagination) Validate

func (m Pagination) Validate(orderFields ...string) (map[string]string, error)

Validate pagination fields validator

type Process

type Process string

Process type for file operation

const (
	// Insert process for file operation
	Insert Process = "insert"
	// Update process for file operation
	Update Process = "update"
	// Distributing process for file operation
	Distributing Process = "distributing"
)

type ReceivedMessage

type ReceivedMessage struct {
	JobName string  `json:"job_name"`
	Type    JobType `json:"type"`
}

ReceivedMessage queuing messasge payload

func NewReceivedMessage

func NewReceivedMessage(str ...string) *ReceivedMessage

NewReceivedMessage building queuing message

type ResponseError

type ResponseError struct {
	ResponseInterface `json:"-"`
	Errors            interface{} `json:"errors"`
	Detail            string      `json:"detail"`
}

ResponseError rest api error response structure

func (ResponseError) ToJSON

func (r ResponseError) ToJSON() string

ToJSON response structure to json string

type ResponseInterface

type ResponseInterface interface {
	ToJSON() string
}

ResponseInterface rest api response interface

type ResponseSuccess

type ResponseSuccess struct {
	ResponseInterface `json:"-"`
	Data              interface{} `json:"data"`
	TotalCount        int64       `json:"total_count"`
}

ResponseSuccess rest api success response structure

func (ResponseSuccess) ToJSON

func (r ResponseSuccess) ToJSON() string

ToJSON response structure to json string

type ResponseSuccessOne

type ResponseSuccessOne struct {
	ResponseInterface `json:"-"`
	Data              interface{} `json:"data"`
}

ResponseSuccessOne rest api success response structure

func (ResponseSuccessOne) ToJSON

func (r ResponseSuccessOne) ToJSON() string

ToJSON response structure to json string

type ResponseToken

type ResponseToken struct {
	ResponseInterface `json:"-"`
	JWT               string `json:"jwt"`
	UserID            int64  `json:"user_id"`
}

ResponseToken JWT auth response

func (ResponseToken) ToJSON

func (r ResponseToken) ToJSON() string

ToJSON JWT auth struct to json string

type TokenRequest

type TokenRequest struct {
	Passphrase string `json:"passphrase" validate:"required"`
}

TokenRequest api token request structure

Jump to

Keyboard shortcuts

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