{"id":117,"date":"2024-04-11T12:24:42","date_gmt":"2024-04-11T04:24:42","guid":{"rendered":"http:\/\/120.55.184.7\/?p=117"},"modified":"2025-04-18T15:58:44","modified_gmt":"2025-04-18T07:58:44","slug":"golang-context-%e6%b7%b1%e5%ba%a6%e8%a7%a3%e6%9e%90%ef%bc%9a%e4%bb%8e%e5%8e%9f%e7%90%86%e5%88%b0%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5","status":"publish","type":"post","link":"https:\/\/beijian99.top\/?p=117","title":{"rendered":"Golang Context"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u5728 Go \u5e76\u53d1\u7f16\u7a0b\u4e2d\uff0c<code>context<\/code>\u00a0\u5305\u662f\u4e00\u4e2a\u5c0f\u800c\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5b83\u5e2e\u52a9\u6211\u4eec\u4f18\u96c5\u5730\u7ba1\u7406 Goroutine \u7684\u751f\u547d\u5468\u671f\u3001\u4f20\u9012\u8bf7\u6c42\u8303\u56f4\u7684\u6570\u636e\u4ee5\u53ca\u5904\u7406\u8d85\u65f6\u548c\u53d6\u6d88\u64cd\u4f5c\u3002<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001Context \u7684\u8bbe\u8ba1\u54f2\u5b66<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1.1 \u4e3a\u4ec0\u4e48\u9700\u8981 Context\uff1f<\/h3>\n\n\n\n<p>\u5728 Go \u7684\u5e76\u53d1\u6a21\u578b\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u9047\u5230\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u4f55\u4f18\u96c5\u5730\u53d6\u6d88\u4e00\u7cfb\u5217\u5173\u8054\u7684 Goroutine\uff1f<\/li>\n\n\n\n<li>\u5982\u4f55\u5728\u591a\u4e2a Goroutine \u4e4b\u95f4\u5b89\u5168\u5730\u4f20\u9012\u8bf7\u6c42\u76f8\u5173\u7684\u6570\u636e\uff1f<\/li>\n\n\n\n<li>\u5982\u4f55\u4e3a\u64cd\u4f5c\u8bbe\u7f6e\u5408\u7406\u7684\u8d85\u65f6\u65f6\u95f4\uff1f<\/li>\n<\/ul>\n\n\n\n<p>Context \u6b63\u662f\u4e3a\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\u800c\u751f\u7684\u6807\u51c6\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.2 \u6838\u5fc3\u8bbe\u8ba1\u7406\u5ff5<\/h3>\n\n\n\n<p>Context \u7684\u8bbe\u8ba1\u9075\u5faa\u4e86\u51e0\u4e2a\u91cd\u8981\u539f\u5219\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u200b<strong>\u200b\u4e0d\u53ef\u53d8\u6027\u200b<\/strong>\u200b\uff1aContext \u5bf9\u8c61\u662f\u4e0d\u53ef\u53d8\u7684\uff0c\u4efb\u4f55\u4fee\u6539\u90fd\u4f1a\u751f\u6210\u65b0\u7684 Context<\/li>\n\n\n\n<li>\u200b<strong>\u200b\u6811\u5f62\u7ed3\u6784\u200b<\/strong>\u200b\uff1aContext \u5f62\u6210\u7236\u5b50\u5173\u7cfb\u7684\u6811\u5f62\u7ed3\u6784\uff0c\u53d6\u6d88\u64cd\u4f5c\u4f1a\u5411\u4e0b\u4f20\u64ad<\/li>\n\n\n\n<li>\u200b<strong>\u200b\u63a5\u53e3\u7edf\u4e00\u200b<\/strong>\u200b\uff1a\u901a\u8fc7\u6807\u51c6\u63a5\u53e3\u4e0e\u5404\u79cd\u5b9e\u73b0\u4ea4\u4e92<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001Context \u6838\u5fc3\u63a5\u53e3\u89e3\u6790<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><mark style=\"background-color:#ffe2c7\" class=\"has-inline-color\">type Context interface {<br>    Deadline() (deadline time.Time, ok bool)<br>    Done() &lt;-chan struct{}<br>    Err() error<br>    Value(key any) any<br>}<\/mark><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 \u65b9\u6cd5\u8be6\u89e3<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u200b<strong>\u200bDeadline()\u200b<\/strong>\u200b\uff1a\u8fd4\u56de Context \u7684\u622a\u6b62\u65f6\u95f4\uff08\u5982\u679c\u8bbe\u7f6e\u4e86\uff09<\/li>\n\n\n\n<li>\u200b<strong>\u200bDone()\u200b<\/strong>\u200b\uff1a\u8fd4\u56de\u4e00\u4e2a\u53ea\u8bfb channel\uff0c\u7528\u4e8e\u63a5\u6536\u53d6\u6d88\u4fe1\u53f7<\/li>\n\n\n\n<li>\u200b<strong>\u200bErr()\u200b<\/strong>\u200b\uff1a\u8fd4\u56de Context \u88ab\u53d6\u6d88\u7684\u539f\u56e0<\/li>\n\n\n\n<li>\u200b<strong>\u200bValue(key)\u200b<\/strong>\u200b\uff1a\u83b7\u53d6\u4e0e key \u5173\u8054\u7684\u503c<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001Context \u7684\u521b\u5efa\u4e0e\u6d3e\u751f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">3.1 \u57fa\u7840 Context<\/h3>\n\n\n\n<p><mark style=\"background-color:#ffe2c7\" class=\"has-inline-color\"><em>\/\/ \u901a\u5e38\u7528\u4f5c\u6839 Context<\/em><br>background := context.Background()<br><br><em>\/\/ \u5f53\u4e0d\u786e\u5b9a\u4f7f\u7528\u54ea\u79cd Context \u65f6\u4f7f\u7528<\/em><br>todo := context.TODO()<\/mark><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.2 \u6d3e\u751f Context<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">3.2.1 WithCancel<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><mark style=\"background-color:#ffe2c7\" class=\"has-inline-color\">ctx, cancel := context.WithCancel(parentCtx)<br>defer cancel() <em>\/\/ \u786e\u4fdd\u8d44\u6e90\u91ca\u653e<\/em><\/mark><br><br><em>\/\/ \u5728\u9700\u8981\u65f6\u8c03\u7528 cancel() \u53d6\u6d88\u64cd\u4f5c<\/em><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.2.2 WithTimeout<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em>\/\/ \u8bbe\u7f6e 2 \u79d2\u8d85\u65f6<\/em><br><mark style=\"background-color:#ffe2c7\" class=\"has-inline-color\">ctx, cancel := context.WithTimeout(parentCtx, 2*time.Second)<br>defer cancel()<\/mark><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.2.3 WithDeadline<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em>\/\/ \u8bbe\u7f6e\u7edd\u5bf9\u65f6\u95f4\u622a\u6b62\u70b9<\/em><br><mark style=\"background-color:#ffe2c7\" class=\"has-inline-color\">deadline := time.Now().Add(2 * time.Second)<br>ctx, cancel := context.WithDeadline(parentCtx, deadline)<br>defer cancel()<\/mark><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.2.4 WithValue<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><mark style=\"background-color:#ffe2c7\" class=\"has-inline-color has-foreground-color\">type ctxKey string<br><br>ctx := context.WithValue(parentCtx, ctxKey(\"userID\"), \"12345\")<br>if userID, ok := ctx.Value(ctxKey(\"userID\")).(string); ok {<br>    <em>\/\/ \u4f7f\u7528 userID<\/em><br>}<\/mark><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001\u5b9e\u6218\u5e94\u7528\u573a\u666f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">4.1 HTTP \u670d\u52a1\u4e2d\u7684\u8d85\u65f6\u63a7\u5236<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc handler(w http.ResponseWriter, r *http.Request) {\n    \/\/ \u8bbe\u7f6e\u6574\u4e2a\u8bf7\u6c42\u7684\u8d85\u65f6\u65f6\u95f4\u4e3a 5 \u79d2\n    ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second)\n    defer cancel()\n    \n    \/\/ \u5c06 context \u4f20\u9012\u7ed9\u4e0b\u6e38\u5904\u7406\n    result, err := someLongRunningTask(ctx)\n    if err != nil {\n        \/\/ \u5904\u7406\u9519\u8bef\n        return\n    }\n    \n    \/\/ \u8fd4\u56de\u7ed3\u679c\n    w.Write(&#x5B;]byte(result))\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">4.2 \u5e76\u53d1\u4efb\u52a1\u63a7\u5236<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc processTasks(ctx context.Context, tasks &#x5B;]Task) error {\n    g, ctx := errgroup.WithContext(ctx)\n    \n    for _, task := range tasks {\n        task := task \/\/ \u521b\u5efa\u5c40\u90e8\u53d8\u91cf\n        g.Go(func() error {\n            select {\n            case &lt;-ctx.Done():\n                return ctx.Err() \/\/ \u88ab\u53d6\u6d88\u65f6\u8fd4\u56de\n            default:\n                return task.Execute(ctx)\n            }\n        })\n    }\n    \n    return g.Wait()\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">4.3 \u6570\u636e\u5e93\u64cd\u4f5c\u8d85\u65f6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc queryUser(ctx context.Context, db *sql.DB, userID string) (*User, error) {\n    ctx, cancel := context.WithTimeout(ctx, 3*time.Second)\n    defer cancel()\n    \n    row := db.QueryRowContext(ctx, &quot;SELECT * FROM users WHERE id = ?&quot;, userID)\n    \n    var user User\n    if err := row.Scan(&amp;user.ID, &amp;user.Name); err != nil {\n        return nil, fmt.Errorf(&quot;query user: %w&quot;, err)\n    }\n    \n    return &amp;user, nil\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001\u6700\u4f73\u5b9e\u8df5\u4e0e\u5e38\u89c1\u9677\u9631<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">5.1 \u6700\u4f73\u5b9e\u8df5<\/h3>\n\n\n\n<p>1.<strong>Context \u5e94\u8be5\u4f5c\u4e3a\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\n\/\/ \u6b63\u786e\nfunc DoSomething(ctx context.Context, arg1, arg2 string) {}\n\n\/\/ \u9519\u8bef\nfunc DoSomething(arg1, arg2 string, ctx context.Context) {}\n<\/pre><\/div>\n\n\n<p>\u200b<strong>\u200b2.\u907f\u514d\u5c06 Context \u5b58\u50a8\u5728\u7ed3\u6784\u4f53\u4e2d\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\n\/\/ \u9519\u8bef\u793a\u8303\ntype Client struct {\n    ctx context.Context\n}\n<\/pre><\/div>\n\n\n<p>3.<strong>\u4f7f\u7528\u81ea\u5b9a\u4e49\u7c7b\u578b\u4f5c\u4e3a context key\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\ntype ctxKey string\n\nconst requestIDKey ctxKey = &quot;requestID&quot;\n\nctx := context.WithValue(parentCtx, requestIDKey, &quot;123&quot;)\n<\/pre><\/div>\n\n\n<p>4.<strong>\u603b\u662f\u68c0\u67e5 Done() \u901a\u9053\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nselect {\ncase &lt;-ctx.Done():\n    return ctx.Err()\ncase result := &lt;-ch:\n    return result\n}\n<\/pre><\/div>\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">5.2 \u5e38\u89c1\u9677\u9631<\/h3>\n\n\n\n<p>\u200b<strong>\u200b1.\u5fd8\u8bb0\u8c03\u7528 cancel \u51fd\u6570\u200b<\/strong>\u200b\uff1a<strong>\u200b<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\n\/\/ \u9519\u8bef\uff1a\u53ef\u80fd\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\nctx, _ := context.WithCancel(parentCtx)\n\n\/\/ \u6b63\u786e\nctx, cancel := context.WithCancel(parentCtx)\ndefer cancel()\n<\/pre><\/div>\n\n\n<p>2.<strong>\u6ee5\u7528 context.Value\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4ec5\u7528\u4e8e\u4f20\u9012\u8bf7\u6c42\u8303\u56f4\u7684\u6570\u636e<\/li>\n\n\n\n<li>\u4e0d\u8981\u7528\u4e8e\u4f20\u9012\u51fd\u6570\u53c2\u6570\u6216\u4e1a\u52a1\u903b\u8f91\u6570\u636e\u200b<strong>\u200b<\/strong>     <\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<p>3.<strong>\u200b\u963b\u585e\u64cd\u4f5c\u4e0d\u68c0\u67e5 Done()\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\n\/\/ \u9519\u8bef\uff1a\u53ef\u80fd\u6c38\u8fdc\u963b\u585e\nresult := &lt;-ch\n\n\/\/ \u6b63\u786e\nselect {\ncase &lt;-ctx.Done():\n    return ctx.Err()\ncase result := &lt;-ch:\n    return result\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u516d\u3001Context \u7684\u5185\u90e8\u5b9e\u73b0<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">6.1 \u53d6\u6d88\u4f20\u64ad\u673a\u5236<\/h3>\n\n\n\n<p>\u5f53\u8c03\u7528 cancel \u51fd\u6570\u65f6\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5173\u95ed\u5185\u90e8\u7684 done channel<\/li>\n\n\n\n<li>\u9012\u5f52\u53d6\u6d88\u6240\u6709\u5b50 context<\/li>\n\n\n\n<li>\u4ece\u7236 context \u4e2d\u79fb\u9664\u81ea\u5df1<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">6.2 \u6027\u80fd\u4f18\u5316<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u200b<strong>\u200bdone channel \u7684\u61d2\u52a0\u8f7d\u200b<\/strong>\u200b\uff1a\n<ul class=\"wp-block-list\">\n<li>\u53ea\u6709\u7b2c\u4e00\u6b21\u8c03\u7528 Done() \u65f6\u624d\u4f1a\u521b\u5efa channel<\/li>\n\n\n\n<li>\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u5185\u5b58\u5206\u914d<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u200b<strong>\u200bvalueCtx \u7684\u94fe\u5f0f\u67e5\u627e\u200b<\/strong>\u200b\uff1a<code>func (c *valueCtx) Value(key any) any { if c.key == key { return c.val } return c.Context.Value(key) }<\/code><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e03\u3001\u603b\u7ed3<\/h2>\n\n\n\n<p>Context \u662f Go \u5e76\u53d1\u7f16\u7a0b\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u6807\u51c6\u5316\u7684\u65b9\u5f0f\u6765\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7ba1\u7406 Goroutine \u7684\u751f\u547d\u5468\u671f<\/li>\n\n\n\n<li>\u4f20\u64ad\u53d6\u6d88\u4fe1\u53f7<\/li>\n\n\n\n<li>\u5904\u7406\u8d85\u65f6\u548c\u622a\u6b62\u65f6\u95f4<\/li>\n\n\n\n<li>\u5b89\u5168\u5730\u4f20\u9012\u8bf7\u6c42\u8303\u56f4\u7684\u6570\u636e<\/li>\n<\/ul>\n\n\n\n<p>\u6b63\u786e\u4f7f\u7528 Context \u53ef\u4ee5\u4f7f\u4ee3\u7801\u66f4\u52a0\u5065\u58ee\u3001\u53ef\u7ef4\u62a4\uff0c\u5e76\u4e14\u80fd\u591f\u66f4\u597d\u5730\u5904\u7406\u8d44\u6e90\u6e05\u7406\u548c\u8d85\u65f6\u63a7\u5236\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Go \u5e76\u53d1\u7f16\u7a0b\u4e2d\uff0ccontext\u00a0\u5305\u662f\u4e00\u4e2a\u5c0f\u800c\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5b83\u5e2e\u52a9\u6211\u4eec\u4f18\u96c5\u5730\u7ba1\u7406 Goroutine \u7684\u751f\u547d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[121],"tags":[],"class_list":["post-117","post","type-post","status-publish","format-standard","hentry","category-golang"],"_links":{"self":[{"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/posts\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=117"}],"version-history":[{"count":10,"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions"}],"predecessor-version":[{"id":689,"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions\/689"}],"wp:attachment":[{"href":"https:\/\/beijian99.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}