コード例 #1
0
        public async Task <DbVote> SetAsync(string userId, nhitomiObject obj, VoteType type, CancellationToken cancellationToken = default)
        {
            var entry = _client.Entry(new DbVote
            {
                Type     = type,
                UserId   = userId,
                Target   = obj.Type,
                TargetId = obj.Id
            });

            return(await entry.UpdateAsync(cancellationToken)); // this will upsert
        }
コード例 #2
0
        public async Task <Dictionary <string, string> > SetConfigAsync(Dictionary <string, string> data)
        {
            var entry = _elastic.Entry <DbCompositeConfig>(DbCompositeConfig.DefaultId);

            entry.Value ??= new DbCompositeConfig();

            entry.Value.Config = data;

            await entry.UpdateAsync();

            await Task.Delay(_serverOptions.ConfigurationReloadInterval);

            return(GetConfig());
        }