Skip to content

Commit

Permalink
chore: deploy docs of project Nop Entropy via GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nop-cao committed Aug 24, 2024
1 parent 3936753 commit 9cd7a6f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,9 @@ <h2 id="数据类型"><a href="#数据类型" class="headerlink" title="数据

<p>对于Timestamp类型,缺省按照<code>yyyy-MM-dd HH:mm:ss</code>格式进行显示。在XMeta配置中,可以为prop配置<code>graphql:datePattern</code>来改为其他格式。<br>如果希望timestamp返回毫秒数,则可以配置pattern为<code>ms</code>,这是一个特殊约定的格式名,在DateHelper中识别处理。</p>
<figure class="highlight xml"><table><tr><td class="code"><pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">prop</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;createTime&quot;</span> <span class="hljs-attr">graphql:datePattern</span>=<span class="hljs-string">&quot;ms&quot;</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">prop</span>&gt;</span><br></code></pre></td></tr></table></figure>

<h2 id="使用GraphQL的加载器来加载对象属性"><a href="#使用GraphQL的加载器来加载对象属性" class="headerlink" title="使用GraphQL的加载器来加载对象属性"></a>使用GraphQL的加载器来加载对象属性</h2><p>例如使用dao获取到User对象之后,希望自动根据status获取到<code>status_label</code>属性。</p>
<figure class="highlight javascript"><table><tr><td class="code"><pre><code class="hljs javascript"><span class="hljs-title class_">IEntityDao</span>&lt;<span class="hljs-title class_">NopAuthUser</span>&gt; user = daoProvider.<span class="hljs-title function_">daoFor</span>(<span class="hljs-title class_">NopAuthUser</span>.<span class="hljs-property">class</span>);<br><span class="hljs-title class_">List</span>&lt;<span class="hljs-title class_">NopAuthUser</span>&gt; list = user.<span class="hljs-title function_">findAll</span>();<br><span class="hljs-title class_">IServiceContext</span> svcCtx = <span class="hljs-literal">null</span>; <span class="hljs-comment">// 在后端模板运行时上下文中一般存在svcCtx</span><br><span class="hljs-title class_">CompletionStage</span>&lt;<span class="hljs-title class_">Object</span>&gt; future = graphQLEngine.<span class="hljs-title function_">fetchResult</span>(list,<br> <span class="hljs-string">&quot;NopAuthUser&quot;</span>, <span class="hljs-string">&quot;...F_defaults,status_label,relatedRoleList&quot;</span>, svcCtx);<br><span class="hljs-title function_">output</span>(<span class="hljs-string">&quot;result.json5&quot;</span>, <span class="hljs-title class_">FutureHelper</span>.<span class="hljs-title function_">syncGet</span>(future));<br></code></pre></td></tr></table></figure>
</div>
<footer class="Article-footer col-md-3">

Expand Down

0 comments on commit 9cd7a6f

Please sign in to comment.