/
krasninja
/
querycat
Обзор
Документация
Войти
/
krasninja
/
querycat
Код
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
sdk/dotnet-sdk/Function.cs
272 строки
8 KB
Ivan Kozhin
Implement safe mode calls
04 фев 2024, 05:48
04 фев 2024, 05:48
4a5c0e3
Код
Авторство
О чём код?
/** * Autogenerated by Thrift Compiler (0.19.0) * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Thrift; using Thrift.Collections; using Thrift.Protocol; using Thrift.Protocol.Entities; using Thrift.Protocol.Utilities; using Thrift.Transport; using Thrift.Transport.Client; using Thrift.Transport.Server; using Thrift.Processor; #nullable enable // requires C# 8.0 #pragma warning disable IDE0079 // remove unnecessary pragmas #pragma warning disable IDE0017 // object init can be simplified #pragma warning disable IDE0028 // collection init can be simplified #pragma warning disable IDE1006 // parts of the code use IDL spelling #pragma warning disable CA1822 // empty DeepCopy() methods still non-static namespace QueryCat.Plugins.Sdk { public partial class Function : TBase { private bool _is_safe; public string Signature { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public bool IsAggregate { get; set; } = false; public bool IsSafe { get { return _is_safe; } set { __isset.is_safe = true; this._is_safe = value; } } public Isset __isset; public struct Isset { public bool is_safe; } public Function() { } public Function(string @signature, string @description, bool is_aggregate) : this() { this.Signature = @signature; this.Description = @description; this.IsAggregate = is_aggregate; } public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { bool isset_signature = false; bool isset_description = false; bool isset_is_aggregate = false; TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { Signature = await iprot.ReadStringAsync(cancellationToken); isset_signature = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.String) { Description = await iprot.ReadStringAsync(cancellationToken); isset_description = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.Bool) { IsAggregate = await iprot.ReadBoolAsync(cancellationToken); isset_is_aggregate = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.Bool) { IsSafe = await iprot.ReadBoolAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); if (!isset_signature) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_description) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_is_aggregate) { throw new TProtocolException(TProtocolException.INVALID_DATA); } } finally { iprot.DecrementRecursionDepth(); } } public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) { oprot.IncrementRecursionDepth(); try { var tmp16 = new TStruct("Function"); await oprot.WriteStructBeginAsync(tmp16, cancellationToken); var tmp17 = new TField(); if((Signature != null)) { tmp17.Name = "signature"; tmp17.Type = TType.String; tmp17.ID = 1; await oprot.WriteFieldBeginAsync(tmp17, cancellationToken); await oprot.WriteStringAsync(Signature, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Description != null)) { tmp17.Name = "description"; tmp17.Type = TType.String; tmp17.ID = 2; await oprot.WriteFieldBeginAsync(tmp17, cancellationToken); await oprot.WriteStringAsync(Description, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } tmp17.Name = "is_aggregate"; tmp17.Type = TType.Bool; tmp17.ID = 3; await oprot.WriteFieldBeginAsync(tmp17, cancellationToken); await oprot.WriteBoolAsync(IsAggregate, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); if(__isset.is_safe) { tmp17.Name = "is_safe"; tmp17.Type = TType.Bool; tmp17.ID = 4; await oprot.WriteFieldBeginAsync(tmp17, cancellationToken); await oprot.WriteBoolAsync(IsSafe, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } await oprot.WriteFieldStopAsync(cancellationToken); await oprot.WriteStructEndAsync(cancellationToken); } finally { oprot.DecrementRecursionDepth(); } } public override bool Equals(object? that) { if (that is not Function other) return false; if (ReferenceEquals(this, other)) return true; return global::System.Object.Equals(Signature, other.Signature) && global::System.Object.Equals(Description, other.Description) && global::System.Object.Equals(IsAggregate, other.IsAggregate) && ((__isset.is_safe == other.__isset.is_safe) && ((!__isset.is_safe) || (global::System.Object.Equals(IsSafe, other.IsSafe)))); } public override int GetHashCode() { int hashcode = 157; unchecked { if((Signature != null)) { hashcode = (hashcode * 397) + Signature.GetHashCode(); } if((Description != null)) { hashcode = (hashcode * 397) + Description.GetHashCode(); } hashcode = (hashcode * 397) + IsAggregate.GetHashCode(); if(__isset.is_safe) { hashcode = (hashcode * 397) + IsSafe.GetHashCode(); } } return hashcode; } public override string ToString() { var tmp18 = new StringBuilder("Function("); if((Signature != null)) { tmp18.Append(", Signature: "); Signature.ToString(tmp18); } if((Description != null)) { tmp18.Append(", Description: "); Description.ToString(tmp18); } tmp18.Append(", IsAggregate: "); IsAggregate.ToString(tmp18); if(__isset.is_safe) { tmp18.Append(", IsSafe: "); IsSafe.ToString(tmp18); } tmp18.Append(')'); return tmp18.ToString(); } } }