client

package
v0.0.0-...-1763559 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package client :: items__.go - Query result items

Package client :: models__.go - extended model functions

Package client :: orm__.go - extended definitions and relationships

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteError

func WriteError(w http.ResponseWriter, code int, apiInfo, message, trace string) api.Error

WriteError writes status code and returns Error

Types

type ApiError

type ApiError struct {

	// APIInfo describes API path and version.
	ApiInfo string `json:"apiInfo,omitempty"`

	// Code is an integer HTTP status code.
	Code int32 `json:"code"`

	// CodeStatus is an HTTP status.
	CodeStatus string `json:"codeStatus,omitempty"`

	// Message defines a message associated with the error.
	Message string `json:"message"`

	// Log is additional error information, e.g. log entries, stack trace, etc.
	Log string `json:"log,omitempty"`
}

APIError is a standard error object returned by all API calls

func NewApiError

func NewApiError(code int, apiInfo, message, log string) *ApiError

NewApiError constructs an ApiError

Note: ApiError implements both standard error and api.Error interfaces See github.com/dockerian/go-coding/pkg/api

func (*ApiError) Error

func (apiError *ApiError) Error() string

Error implements error interface

func (*ApiError) Status

func (apiError *ApiError) Status() int

Status implements api.Error interface (see pkg/cli/appError.go)

func (*ApiError) WriteError

func (apiError *ApiError) WriteError(w http.ResponseWriter) api.Error

WriteError writes status code and returns api.Error

type ApiSchema

type ApiSchema struct {

	// Go-coding API schema version.
	Version string `json:"version,omitempty"`

	// Go-coding API description.
	Description string `json:"description,omitempty"`

	// Go-coding API endpoint URL.
	EndpointURL string `json:"endpointURL,omitempty"`

	// Swagger yaml file.
	SwaggerYaml string `json:"swaggerYaml,omitempty"`

	DbInfo DbSchema `json:"dbInfo,omitempty"`
}

APISchema provides detailed info for current API spec.

type DbSchema

type DbSchema struct {

	// ID represents a schema identifier.
	Id int32 `json:"id,omitempty"`

	// DbVersion is the database schema version.
	DbVersion string `json:"dbVersion,omitempty"`

	// ChangeDate is a date/time string of the schema change.
	ChangeDate string `json:"changeDate,omitempty"`

	// Author (in format of 'Name <email.address>') of database schema change.
	Author string `json:"author,omitempty"`

	// Description of the schema change.
	Description string `json:"description,omitempty"`

	// DeployNotes is a special notes for database deployment.
	DeployNotes string `json:"deployNotes,omitempty"`

	// Scriptis the SQL script file name for database deployment.
	Script string `json:"script,omitempty"`
}

DbSchema provides detailed info for database releases.

func (*DbSchema) TableName

func (*DbSchema) TableName() string

TableName sets DbSchema's table name to be `db_schema`

type QueryResults

type QueryResults struct {

	// Count defines number of items in items
	Count int `json:"count,omitempty"`

	// Count defines total number of items in all pages, if page and count queries is provided
	CountAll int `json:"countAll,omitempty"`

	// PageOffset defines zero-based page offset
	PageOffset int `json:"pageOffset,omitempty"`

	// PageSize defines page size of current selection
	PageSize int `json:"pageSize,omitempty"`

	// NextURL specifies the URL for fetching next page, if available
	NextURL string `json:"nextUrl,omitempty"`

	// Items represents a collection of query results
	Items json.RawMessage `json:"items,omitempty"`
}

QueryResults struct defines a query result with count, and a collection of items

type User

type User struct {

	// ID is a user identifier
	Id int32 `json:"id,omitempty"`

	// Active indicates if the user is active.
	Active bool `json:"active,omitempty"`

	// Alias is user name alias.
	Alias string `json:"alias,omitempty"`

	// APIKey is user API key for service requests.
	ApiKey string `json:"apiKey,omitempty"`

	// Password stores hashed user password.
	Password string `json:"password,omitempty"`

	// EmailAddress is a user email address.
	EmailAddress string `json:"emailAddress,omitempty"`

	// FirstName is a user's first name.
	FirstName string `json:"firstName,omitempty"`

	// LastName is a user's last name.
	LastName string `json:"lastName,omitempty"`

	// DefaultRole is default role name.
	DefaultRole string `json:"defaultRole,omitempty"`

	// SystemUID is a system user id.
	SystemUid int32 `json:"systemUid,omitempty"`

	// Created is the date/time of the user beinng created.
	Created time.Time `json:"created,omitempty"`

	// LastLoginDateTime is the date/time of the user last login.
	LastLoginDateTime time.Time `json:"lastLoginDateTime,omitempty"`

	// LastSessionID is the last login session identifier.
	LastSessionId int32 `json:"lastSessionId,omitempty"`
}

User defines a user information.

Jump to

Keyboard shortcuts

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