common

package
v0.0.0-...-baadd90 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package common provides basic method and struct definition

Index

Constants

View Source
const (
	// return the field key as 'name' which you can say in the web pages
	FieldKeyName string = "name"
	// return the field key as 'id' which you can't say in the web pages
	FieldKeyId string = "id"
	// the sort descending for records
	OrderDesc string = "desc"
	// the sort ascending for records
	OrderAsc string = "asc"
	// the default request host
	DefaultHost string = "https://lib.cn"
	// format the return field value as string
	CellFormatString string = "string"
	// format the return field value as real object
	CellFormatJson string = "json"
	// the default per page records count
	DefaultPageSize int = 100
	// the max count for get get records
	MaxPageSize int = 1000
	// the default page for paged records
	DefaultPageNum int = 1
	// the default request timeout
	DefaultRequestTimeout time.Duration = 60000000000
)

lib sdk global constants

Variables

This section is empty.

Functions

func FileBuffer

func FileBuffer(filePath string) ([]byte, string, error)

func GetFileContentType

func GetFileContentType(out *os.File) (string, error)

func Int64Ptr

func Int64Ptr(v int64) *int64

func StringPtr

func StringPtr(v string) *string

func StringPtrs

func StringPtrs(vals []string) []*string

Types

type Client

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

func (*Client) Init

func (c *Client) Init() *Client

func (*Client) Send

func (c *Client) Send(request athttp.Request, response athttp.Response) (err error)

func (*Client) WithCredential

func (c *Client) WithCredential(cred *Credential) *Client

func (*Client) WithDebug

func (c *Client) WithDebug(flag bool) *Client

func (*Client) WithProfile

func (c *Client) WithProfile(clientProfile *profile.ClientProfile) *Client

type Common

type Common interface {
	NewCredential(token string)
}

type Credential

type Credential struct {
	Token string
}

func NewCredential

func NewCredential(token string) *Credential

Directories

Path Synopsis
Package error provides custom sdk error
Package error provides custom sdk error
Package http provides basic http request/response method and definition
Package http provides basic http request/response method and definition
Package profile provides client common profiles
Package profile provides client common profiles

Jump to

Keyboard shortcuts

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