Documentation ¶
Index ¶
- Constants
- func DBOrder(orders []Order, validOrderMap map[string]string) string
- func DeleteStrSliceElms(sl []string, elms ...string) []string
- func EnsureIndex(ctx context.Context, collection *mongo.Collection, indexName string, ...) (err error)
- func GenClusterID() string
- func GenDataModelEntitySetName(name string) string
- func GenDataModelHeaderOfID(name string) string
- func GenDataModelID() string
- func GenNotebookServerID() string
- func GenPublicWorkspaceID() string
- func GenRunID() string
- func GenSubmissionID() string
- func GenWorkflowFileID() string
- func GenWorkflowID() string
- func GenWorkflowVersionID() string
- func GenWorkspaceID() string
- func GetDataModelType(dataModelName string) string
- func GetSubPath(basepath, targpath string) (string, bool)
- func GrpcDial(conn ConnectInfo, authInfo AuthInfo) (*grpc.ClientConn, error)
- func HttpDial(conn ConnectInfo, authInfo AuthInfo) (*c.Client, error)
- func In(elm string, elms []string) bool
- func MarshalParamValue(value interface{}) (string, error)
- func NewBasicAuthRPCCredentials(username, password string) credentials.PerRPCCredentials
- func NewHTTPTlSConfig(conn ConnectInfo) (*tls.Config, error)
- func NewRPCCredentialFromAuthInfo(authInfo AuthInfo) credentials.PerRPCCredentials
- func NewTokenRPCCredentials(token string) credentials.PerRPCCredentials
- func PointBool(b bool) *bool
- func PointFloat64(f float64) *float64
- func PointInt32(i int32) *int32
- func PointInt64(i int64) *int64
- func PointMetav1Time(b metav1.Time) *metav1.Time
- func PointString(s string) *string
- func PointTime(b time.Time) *time.Time
- func ReadDataModelFromCSV(filePath string) ([]string, [][]string, error)
- func SearchWordFilter(db *gorm.DB, word string, fields []string, exact bool) *gorm.DB
- func ToGRPCError(err error) error
- func UnmarshalParamValue(value string) interface{}
- func Unzip(zipFilePath, targetDir string) error
- func ValidateFSDirectory(dirname string) error
- func ValidateFileExist(filePath string) error
- func WriteHertzAcceptedResponse(c *app.RequestContext)
- func WriteHertzCreatedResponse(c *app.RequestContext, data interface{})
- func WriteHertzErrorResponse(c *app.RequestContext, err error)
- func WriteHertzOKResponse(c *app.RequestContext, data interface{})
- func ZipDir(srcDir string, zipFileName string) error
- type AuthInfo
- type ConnectInfo
- type MongoPaginate
- type Order
- type Pagination
- func (q *Pagination) GetHasMore(totalCount int) bool
- func (q *Pagination) GetLimit() int
- func (q *Pagination) GetOffset() int
- func (q *Pagination) GetOrderBy() string
- func (q *Pagination) GetPage() int
- func (q *Pagination) GetQueryString() string
- func (q *Pagination) GetSize() int
- func (q *Pagination) GetTotalPages(totalCount int) int
- func (q *Pagination) SetOrderBy(orderByQuery string) error
- type TransportWithAuth
Constants ¶
const ( MAX_COUNT = 10000 MAX_SIZE = 1 * 1024 * 1024 * 1024 MAX_PATH_LENGTH = 512 )
Variables ¶
This section is empty.
Functions ¶
func DeleteStrSliceElms ¶
func EnsureIndex ¶
func GenDataModelEntitySetName ¶
GenDataModelEntitySetName ...
func GenDataModelHeaderOfID ¶
GenDataModelHeaderOfID ...
func GetSubPath ¶
GetSubPath check if target path is subpath of basepath and return subpath
func GrpcDial ¶
func GrpcDial(conn ConnectInfo, authInfo AuthInfo) (*grpc.ClientConn, error)
GrpcDial create grpc client connection
func HttpDial ¶
func HttpDial(conn ConnectInfo, authInfo AuthInfo) (*c.Client, error)
HttpDial create grpc client connection
func MarshalParamValue ¶
MarshalParamValue ...
func NewBasicAuthRPCCredentials ¶
func NewBasicAuthRPCCredentials(username, password string) credentials.PerRPCCredentials
NewBasicAuthRPCCredentials create rpc credentials with basic auth
func NewHTTPTlSConfig ¶
func NewHTTPTlSConfig(conn ConnectInfo) (*tls.Config, error)
func NewRPCCredentialFromAuthInfo ¶
func NewRPCCredentialFromAuthInfo(authInfo AuthInfo) credentials.PerRPCCredentials
func NewTokenRPCCredentials ¶
func NewTokenRPCCredentials(token string) credentials.PerRPCCredentials
NewTokenRPCCredentials create rpc credentials with token
func PointFloat64 ¶
PointFloat64 convert int64 to point of float64.
func PointMetav1Time ¶
PointMetav1Time convert metav1.Time to point of metav1.Time.
func PointString ¶
PointString convert string to point of string.
func ReadDataModelFromCSV ¶
func SearchWordFilter ¶
SearchWordFilter splits keyword by special characters, and the relation between keywords is 'OR'. In addition, we don't need to escape character because special characters has been removed as delimiters.
func UnmarshalParamValue ¶
func UnmarshalParamValue(value string) interface{}
UnmarshalParamValue ...
func ValidateFSDirectory ¶
ValidateFSDirectory check specified path exist and is folder return os.ErrNotExist if not exist
func ValidateFileExist ¶
ValidateFileExist check if given file exist in path.
func WriteHertzAcceptedResponse ¶
func WriteHertzAcceptedResponse(c *app.RequestContext)
WriteHertzAcceptedResponse for soft delete resource.
func WriteHertzCreatedResponse ¶
func WriteHertzCreatedResponse(c *app.RequestContext, data interface{})
WriteHertzCreatedResponse for create resource.
func WriteHertzErrorResponse ¶
func WriteHertzErrorResponse(c *app.RequestContext, err error)
WriteHertzErrorResponse for error response.
func WriteHertzOKResponse ¶
func WriteHertzOKResponse(c *app.RequestContext, data interface{})
WriteHertzOKResponse for all success request.
Types ¶
type AuthInfo ¶
type AuthInfo struct { // username Username string `json:"username,omitempty" mapstructure:"username,omitempty"` // password Password string `json:"password,omitempty" mapstructure:"password,omitempty"` // authorization token AuthToken string `json:"authToken,omitempty" mapstructure:"authToken,omitempty"` }
type ConnectInfo ¶
type ConnectInfo struct { // server address ServerAddr string `json:"serverAddr" mapstructure:"serverAddr"` // server name to override ServerName string `json:"serverName,omitempty" mapstructure:"serverName,omitempty"` // whether use tls Insecure bool `json:"insecure,omitempty" mapstructure:"insecure,omitempty"` // server cert file ServerCertFile string `json:"serverCertFile,omitempty" mapstructure:"serverCertFile,omitempty"` // client cert file ClientCertFile string `json:"clientCertFile,omitempty" mapstructure:"clientCertFile,omitempty"` // client key file ClientCertKeyFile string `json:"clientCertKeyFile" mapstructure:"clientCertKeyFile,omitempty"` // ca file CaFile string `json:"caFile" mapstructure:"caFile,omitempty"` }
func (ConnectInfo) Validate ¶
func (c ConnectInfo) Validate() error
type MongoPaginate ¶
type MongoPaginate struct {
// contains filtered or unexported fields
}
func NewMongoPaginate ¶
func NewMongoPaginate(limit, page int) *MongoPaginate
func (*MongoPaginate) GetPaginatedOpts ¶
func (mp *MongoPaginate) GetPaginatedOpts() *options.FindOptions
type Pagination ¶
type Pagination struct { Size int `validate:"gte=0,lte=100"` Page int `validate:"gte=1"` Orders []Order }
Pagination ...
func NewPagination ¶
func NewPagination(size int, page int) *Pagination
NewPagination returns Pagination of size and page.
func (*Pagination) GetHasMore ¶
func (q *Pagination) GetHasMore(totalCount int) bool
GetHasMore Get has more.
func (*Pagination) GetOrderBy ¶
func (q *Pagination) GetOrderBy() string
GetOrderBy Get orderBy string.
func (*Pagination) GetQueryString ¶
func (q *Pagination) GetQueryString() string
GetQueryString get query string.
func (*Pagination) GetTotalPages ¶
func (q *Pagination) GetTotalPages(totalCount int) int
GetTotalPages Get total pages int.
func (*Pagination) SetOrderBy ¶
func (q *Pagination) SetOrderBy(orderByQuery string) error
SetOrderBy Set order by.
type TransportWithAuth ¶
func NewTransportWithAuth ¶
func NewTransportWithAuth(conn ConnectInfo, authInfo AuthInfo) (*TransportWithAuth, error)
func (TransportWithAuth) Client ¶
func (t TransportWithAuth) Client() *http.Client
func (TransportWithAuth) GetRequestMetadata ¶
func (TransportWithAuth) RequireTransportSecurity ¶
func (b TransportWithAuth) RequireTransportSecurity() bool