// PgShdescriptionByObjoidClassoid retrieves a row from 'pg_catalog.pg_shdescription' as a PgShdescription.
//
// Generated from index 'pg_shdescription_o_c_index'.
358789
func PgShdescriptionByObjoidClassoid(db XODB, objoid pgtypes.Oid, classoid pgtypes.Oid) (*PgShdescription, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, objoid, classoid, description ` +
		`FROM pg_catalog.pg_shdescription ` +
		`WHERE objoid = $1 AND classoid = $2`

	// run query
	XOLog(sqlstr, objoid, classoid)
	ps := PgShdescription{}

	err = db.QueryRow(sqlstr, objoid, classoid).Scan(&ps.Tableoid, &ps.Cmax, &ps.Xmax, &ps.Cmin, &ps.Xmin, &ps.Ctid, &ps.Objoid, &ps.Classoid, &ps.Description)
	if err != nil {
		return nil, err
	}

	return &ps, nil
}
656405
func (api *API) ZoneIDByName(zoneName string) (string, error) {
	res, err := api.ListZonesContext(context.TODO(), WithZoneFilter(zoneName))
	if err != nil {
		return "", errors.Wrap(err, "ListZonesContext command failed")
	}

	if len(res.Result) > 1 && api.OrganizationID == "" {
		return "", errors.New("ambiguous zone name used without an account ID")
	}

	for _, zone := range res.Result {
		if api.OrganizationID != "" {
			if zone.Name == zoneName && api.OrganizationID == zone.Account.ID {
				return zone.ID, nil
			}
		} else {
			if zone.Name == zoneName {
				return zone.ID, nil
			}
		}
	}

	return "", errors.New("Zone could not be found")
}
889715
func (fn ResourcePrinterFunc) PrintObj(obj runtime.Object, w io.Writer) error {
	return fn(obj, w)
}
664368
func (abi *ABI) MethodById(sigdata []byte) (*Method, error) {
	if len(sigdata) < 4 {
		return nil, fmt.Errorf("data too short (%d bytes) for abi method lookup", len(sigdata))
	}
	for _, method := range abi.Methods {
		if bytes.Equal(method.Id(), sigdata[:4]) {
			return &method, nil
		}
	}
	return nil, fmt.Errorf("no method with id: %#x", sigdata[:4])
}
685292
func PgTablespaceByOid(db XODB, oid pgtypes.Oid) (*PgTablespace, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, spcname, spcowner, spcacl, spcoptions ` +
		`FROM pg_catalog.pg_tablespace ` +
		`WHERE oid = $1`

	// run query
	XOLog(sqlstr, oid)
	pt := PgTablespace{}

	err = db.QueryRow(sqlstr, oid).Scan(&pt.Tableoid, &pt.Cmax, &pt.Xmax, &pt.Cmin, &pt.Xmin, &pt.Oid, &pt.Ctid, &pt.Spcname, &pt.Spcowner, &pt.Spcacl, &pt.Spcoptions)
	if err != nil {
		return nil, err
	}

	return &pt, nil
}
916043
func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
	// we use reflect.Indirect here in order to obtain the actual value from a pointer.
	// we need an actual value in order to retrieve the package path for an object.
	// using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
	if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
		return fmt.Errorf(InternalObjectPrinterErr)
	}

	var queryObj interface{} = obj
	if unstructured, ok := obj.(runtime.Unstructured); ok {
		queryObj = unstructured.UnstructuredContent()
	} else {
		data, err := json.Marshal(obj)
		if err != nil {
			return err
		}
		queryObj = map[string]interface{}{}
		if err := json.Unmarshal(data, &queryObj); err != nil {
			return err
		}
	}

	if err := j.JSONPath.Execute(w, queryObj); err != nil {
		buf := bytes.NewBuffer(nil)
		fmt.Fprintf(buf, "Error executing template: %v. Printing more information for debugging the template:\n", err)
		fmt.Fprintf(buf, "\ttemplate was:\n\t\t%v\n", j.rawTemplate)
		fmt.Fprintf(buf, "\tobject given to jsonpath engine was:\n\t\t%#v\n\n", queryObj)
		return fmt.Errorf("error executing jsonpath %q: %v\n", j.rawTemplate, buf.String())
	}
	return nil
}
95319
func MappedOid(val interface{}) proto.Oid {
	switch val.(type) {
	case nil:
		// we can't determine a type here
		return proto.OidUnknown
	case int16:
		return proto.OidInt2
	case int32:
		return proto.OidInt4
	case int64:
		return proto.OidInt8
	case float32:
		return proto.OidFloat4
	case float64:
		return proto.OidFloat8
	case string:
		return proto.OidText
	case bool:
		return proto.OidBool
	default:
		return proto.OidUnknown
	}
}
1256020
func PgSeclabelByObjoidClassoidObjsubidProvider(db XODB, objoid pgtypes.Oid, classoid pgtypes.Oid, objsubid int, provider string) (*PgSeclabel, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, objoid, classoid, objsubid, provider, label ` +
		`FROM pg_catalog.pg_seclabel ` +
		`WHERE objoid = $1 AND classoid = $2 AND objsubid = $3 AND provider = $4`

	// run query
	XOLog(sqlstr, objoid, classoid, objsubid, provider)
	ps := PgSeclabel{}

	err = db.QueryRow(sqlstr, objoid, classoid, objsubid, provider).Scan(&ps.Tableoid, &ps.Cmax, &ps.Xmax, &ps.Cmin, &ps.Xmin, &ps.Ctid, &ps.Objoid, &ps.Classoid, &ps.Objsubid, &ps.Provider, &ps.Label)
	if err != nil {
		return nil, err
	}

	return &ps, nil
}
822368
func PgShseclabelByObjoidClassoidProvider(db XODB, objoid pgtypes.Oid, classoid pgtypes.Oid, provider string) (*PgShseclabel, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, objoid, classoid, provider, label ` +
		`FROM pg_catalog.pg_shseclabel ` +
		`WHERE objoid = $1 AND classoid = $2 AND provider = $3`

	// run query
	XOLog(sqlstr, objoid, classoid, provider)
	ps := PgShseclabel{}

	err = db.QueryRow(sqlstr, objoid, classoid, provider).Scan(&ps.Tableoid, &ps.Cmax, &ps.Xmax, &ps.Cmin, &ps.Xmin, &ps.Ctid, &ps.Objoid, &ps.Classoid, &ps.Provider, &ps.Label)
	if err != nil {
		return nil, err
	}

	return &ps, nil
}
369499
func PgTransformByOid(db XODB, oid pgtypes.Oid) (*PgTransform, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, trftype, trflang, trffromsql, trftosql ` +
		`FROM pg_catalog.pg_transform ` +
		`WHERE oid = $1`

	// run query
	XOLog(sqlstr, oid)
	pt := PgTransform{}

	err = db.QueryRow(sqlstr, oid).Scan(&pt.Tableoid, &pt.Cmax, &pt.Xmax, &pt.Cmin, &pt.Xmin, &pt.Oid, &pt.Ctid, &pt.Trftype, &pt.Trflang, &pt.Trffromsql, &pt.Trftosql)
	if err != nil {
		return nil, err
	}

	return &pt, nil
}
866930
func (mc MongoClient) ValueDescriptorById(id string) (contract.ValueDescriptor, error) {
	query, err := idToBsonM(id)
	if err != nil {
		return contract.ValueDescriptor{}, err
	}

	mvd, err := mc.getValueDescriptor(query)
	if err != nil {
		return contract.ValueDescriptor{}, err
	}
	return mvd.ToContract(), nil
}
792322
func (l *gcsGateway) CopyObject(ctx context.Context, srcBucket string, srcObject string, destBucket string, destObject string,
	srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions) (minio.ObjectInfo, error) {
	if srcOpts.CheckCopyPrecondFn != nil && srcOpts.CheckCopyPrecondFn(srcInfo, "") {
		return minio.ObjectInfo{}, minio.PreConditionFailed{}
	}
	src := l.client.Bucket(srcBucket).Object(srcObject)
	dst := l.client.Bucket(destBucket).Object(destObject)

	copier := dst.CopierFrom(src)
	applyMetadataToGCSAttrs(srcInfo.UserDefined, &copier.ObjectAttrs)

	attrs, err := copier.Run(ctx)
	if err != nil {
		logger.LogIf(ctx, err)
		return minio.ObjectInfo{}, gcsToObjectError(err, destBucket, destObject)
	}

	return fromGCSAttrsToObjectInfo(attrs), nil
}
622824
func PgInheritByInhrelidInhseqno(db XODB, inhrelid pgtypes.Oid, inhseqno int) (*PgInherit, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, inhrelid, inhparent, inhseqno ` +
		`FROM pg_catalog.pg_inherits ` +
		`WHERE inhrelid = $1 AND inhseqno = $2`

	// run query
	XOLog(sqlstr, inhrelid, inhseqno)
	pi := PgInherit{}

	err = db.QueryRow(sqlstr, inhrelid, inhseqno).Scan(&pi.Tableoid, &pi.Cmax, &pi.Xmax, &pi.Cmin, &pi.Xmin, &pi.Ctid, &pi.Inhrelid, &pi.Inhparent, &pi.Inhseqno)
	if err != nil {
		return nil, err
	}

	return &pi, nil
}
381725
func (c Client) copyObjectDo(ctx context.Context, srcBucket, srcObject, destBucket, destObject string,
	metadata map[string]string) (ObjectInfo, error) {

	// Build headers.
	headers := make(http.Header)

	// Set all the metadata headers.
	for k, v := range metadata {
		headers.Set(k, v)
	}

	// Set the source header
	headers.Set("x-amz-copy-source", s3utils.EncodePath(srcBucket+"/"+srcObject))

	// Send upload-part-copy request
	resp, err := c.executeMethod(ctx, "PUT", requestMetadata{
		bucketName:   destBucket,
		objectName:   destObject,
		customHeader: headers,
	})
	defer closeResponse(resp)
	if err != nil {
		return ObjectInfo{}, err
	}

	// Check if we got an error response.
	if resp.StatusCode != http.StatusOK {
		return ObjectInfo{}, httpRespToErrorResponse(resp, srcBucket, srcObject)
	}

	cpObjRes := copyObjectResult{}
	err = xmlDecoder(resp.Body, &cpObjRes)
	if err != nil {
		return ObjectInfo{}, err
	}

	objInfo := ObjectInfo{
		Key:          destObject,
		ETag:         strings.Trim(cpObjRes.ETag, "\""),
		LastModified: cpObjRes.LastModified,
	}
	return objInfo, nil
}
1321760
func (p *JSONPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
	data, err := json.Marshal(obj)
	if err != nil {
		return err
	}
	dst := bytes.Buffer{}
	err = json.Indent(&dst, data, "", "    ")
	dst.WriteByte('\n')
	_, err = w.Write(dst.Bytes())
	return err
}
831226
func (p *TypeSetterPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
	if obj == nil {
		return p.Delegate.PrintObj(obj, w)
	}
	if !obj.GetObjectKind().GroupVersionKind().Empty() {
		return p.Delegate.PrintObj(obj, w)
	}

	// we were empty coming in, make sure we're empty going out.  This makes the call thread-unsafe
	defer func() {
		obj.GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{})
	}()

	gvks, _, err := p.Typer.ObjectKinds(obj)
	if err != nil {
		// printers wrapped by us expect to find the type information present
		return fmt.Errorf("missing apiVersion or kind and cannot assign it; %v", err)
	}

	for _, gvk := range gvks {
		if len(gvk.Kind) == 0 {
			continue
		}
		if len(gvk.Version) == 0 || gvk.Version == runtime.APIVersionInternal {
			continue
		}
		obj.GetObjectKind().SetGroupVersionKind(gvk)
		break
	}

	return p.Delegate.PrintObj(obj, w)
}
741406
func (d *Document) AddObject(object *Object) *Error {

	if d.Mode == ErrorMode {
		return ISE("Cannot add data to a document already possessing errors")
	}

	if d.Mode == ObjectMode && len(d.Data) == 1 {
		return ISE("Single 'data' object response is expected, you are attempting to add more than one element to be returned")
	}

	// if not yet set, add the associated HTTP status with the object
	if d.Status == 0 {
		d.Status = object.Status
	}

	// finally, actually add the object to data List
	if d.Data == nil {
		d.Data = List{object}
	} else {
		d.Data = append(d.Data, object)
	}

	return nil
}