awSQL/docs/docusaurus/build/assets/js/a6964e95.d47aab3b.js
2025-03-14 23:49:58 +01:00

1 line
5.0 KiB
JavaScript

"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[579],{7712:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>r,toc:()=>a});const r=JSON.parse('{"id":"typedefs/constraint-options","title":"ConstraintOptions","description":"Object","source":"@site/docs/typedefs/constraint-options.md","sourceDirName":"typedefs","slug":"/typedefs/constraint-options","permalink":"/awSQL/typedefs/constraint-options","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":2,"frontMatter":{"sidebar_position":2},"sidebar":"defaultSidebar","previous":{"title":"ColumnStructure","permalink":"/awSQL/typedefs/column-structure"}}');var s=t(4848),i=t(8453);const o={sidebar_position:2},l="ConstraintOptions",d={},a=[{value:"Example structure",id:"example-structure",level:2},{value:"Properties",id:"properties",level:2},{value:".primary",id:"primary",level:3},{value:".index",id:"index",level:3},{value:".null",id:"null",level:3},{value:".unique",id:"unique",level:3},{value:".default",id:"default",level:3},{value:".auto_increment",id:"auto_increment",level:3},{value:".unsigned",id:"unsigned",level:3}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"constraintoptions",children:"ConstraintOptions"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.code,{children:"Object"})}),"\n",(0,s.jsxs)(n.p,{children:["An object used to define additional constraints for a column within a ",(0,s.jsx)(n.a,{href:"../classes/structure",children:"Structure"}),"."]}),"\n",(0,s.jsxs)(n.admonition,{type:"info",children:[(0,s.jsxs)(n.p,{children:["All keys within this object are ",(0,s.jsx)(n.strong,{children:"optional"}),"."]}),(0,s.jsx)(n.p,{children:"You only need to define the keys for the settings you want to enable."}),(0,s.jsxs)(n.p,{children:["Default values are always ",(0,s.jsx)(n.code,{children:"false"})," on ",(0,s.jsx)(n.strong,{children:"Booleans"})," or ",(0,s.jsx)(n.code,{children:'""'})," on ",(0,s.jsx)(n.strong,{children:"Strings"})]})]}),"\n",(0,s.jsx)(n.h2,{id:"example-structure",children:"Example structure"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'{\r\n "primary": true,\r\n "index": true,\r\n "null": true,\r\n "unique": true,\r\n "default": "Some default text",\r\n "auto_increment": false,\r\n "unsigned": true\r\n}\n'})}),"\n",(0,s.jsx)(n.h2,{id:"properties",children:"Properties"}),"\n",(0,s.jsx)(n.h3,{id:"primary",children:".primary"}),"\n",(0,s.jsxs)(n.p,{children:["\u2192 ",(0,s.jsx)(n.strong,{children:"Boolean"})]}),"\n",(0,s.jsx)(n.p,{children:"Whether this column should be the primary one."}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"index",children:".index"}),"\n",(0,s.jsxs)(n.p,{children:["\u2192 ",(0,s.jsx)(n.strong,{children:"Boolean"})]}),"\n",(0,s.jsx)(n.p,{children:"Whether this column should be indexable (Faster query, slower insertion)"}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"null",children:".null"}),"\n",(0,s.jsxs)(n.p,{children:["\u2192 ",(0,s.jsx)(n.strong,{children:"Boolean"})]}),"\n",(0,s.jsx)(n.p,{children:"Whether this column is null per default"}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"unique",children:".unique"}),"\n",(0,s.jsxs)(n.p,{children:["\u2192 ",(0,s.jsx)(n.strong,{children:"Boolean"})]}),"\n",(0,s.jsx)(n.p,{children:"Whether this column data should be unique and block duplicate data."}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"default",children:".default"}),"\n",(0,s.jsxs)(n.p,{children:["\u2192 ",(0,s.jsx)(n.strong,{children:"String"})]}),"\n",(0,s.jsx)(n.p,{children:"Sets the default data for this column that gets inserted if no data was given on insertion."}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"auto_increment",children:".auto_increment"}),"\n",(0,s.jsxs)(n.p,{children:["\u2192 ",(0,s.jsx)(n.strong,{children:"Boolean"})]}),"\n",(0,s.jsx)(n.p,{children:"Whether this column should be numerical incremented on new insertions."}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"unsigned",children:".unsigned"}),"\n",(0,s.jsxs)(n.p,{children:["\u2192 ",(0,s.jsx)(n.strong,{children:"Boolean"})]}),"\n",(0,s.jsx)(n.admonition,{title:"Warning",type:"danger",children:(0,s.jsx)(n.p,{children:"This option is only valid on numerical columns."})}),"\n",(0,s.jsx)(n.p,{children:"Whether this column should be unsigned."}),"\n",(0,s.jsx)(n.hr,{})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>l});var r=t(6540);const s={},i=r.createContext(s);function o(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]);