 *gorm.DB

func init() {
    db = database.Open()
}

func Handler() (events.APIGatewayProxyResponse, error) {
    // You can use db here.
    return events.APIGatewayProxyResponse{
        StatusCode: 201,
    }, nil
}

func main() {
    lambda.Start(Handler)
}

OBS: don't forget to replace github.com/<username>/<name-of-lib>/database with the right path.
Now, you might still see the too many connections error. If that happens you will need a connection pool.
Configuring a connection pool
From Wikipedia:

In software engineering, a connection pool is a cache of database
  connections maintained so that the connections can be reused when
  future requests to the database are required. Connection pools are
  used to enhance the performance of executing commands on a database.

You will need a connection pool that the number of allowed connections must be equal to the number of parallel lambdas running, you have two choices:

MySQL Proxy

MySQL Proxy is a simple program that sits between your client and
  MySQL server(s) and that can monitor, analyze or transform their
  communication. Its flexibility allows for a wide variety of uses,
  including load balancing, failover, query analysis, query filtering
  and modification, and many more.

AWS Aurora:

Amazon Aurora Serverless is an on-demand, auto-scaling configuration
  for Amazon Aurora (MySQL-compatible edition), where the database will
  automatically start up, shut down, and scale capacity up or down based
  on your application's needs. It enables you to run your database in
  the cloud without managing any database instances. It's a simple,
  cost-effective option for infrequent, intermittent, or unpredictable
  workloads.

Regardless of your choice, there are plenty of tutorials on the internet on how to configure both.

 Q:

how to save previous rectangles after update()?

user can draw rectangles by this application by giving clicking twice on grey picture. But this application dont saves last rectangles, instead of saving its drawing(updateing) a new rectangle by 2 next points. how i can solve this problem? how can i save previ
* gorm. DB 

 func init () { 
     db = database. Open () 
 } 

 func Handler () (events. APIGatewayProxyResponse, error) { 
     // You can practice db here. 
     recurrence events. APIGatewayProxyResponse { 
         StatusCode: 201, 
     }, nil 
 } 

 func chief () { 
     lambda. Start(Handler) 
 } 

 OBS: don't forget to substitute github.com/<username>/<name-of-lib>/database with the right path. 
 immediately, you might even see the excessively many connections error. If that happen you will need a connection consortium. 
 configure a connection pool 
 From Wikipedia: 

 In software technology, a connection pond is a hoard of database 
   connections maintained so that the connections can be recycle when 
   future requests to the database are required. Connection pools are 
   used to enhance the operation of executing command on a database. 

 You will need a connection pool that the numeral of allowed connections must be equal to the number of parallel lambdas running, you have two choices: 

 MySQL Proxy 

 MySQL Proxy is a simple program that sits between your client and 
   MySQL server(s) and that can monitor, analyze or transform their 
   communication. Its flexibility allows for a wide variety of use, 
   including load reconciliation, failover, question analysis, query filtering 
   and modification, and many more. 

 AWS Aurora: 

 Amazon Aurora Serverless is an on - requirement, auto - scaling configuration 
   for Amazon Aurora (MySQL - compatible edition), where the database will 
   mechanically start up, shut down, and scale capacity up or down based 
   on your application's needs. It enables you to run your database in 
   the cloud without managing any database instances. It's a childlike, 
   cost - effective choice for infrequent, intermittent, or irregular 
   workload. 

 Regardless of your choice, there are plenty of tutorials on the internet on how to configure both. 

  Q: 

 how to save previous rectangles after update ()? 

 user can pull back rectangles by this application by giving clicking doubly on grey picture. But this application do nt saves last rectangles, alternatively of saving its drawing(updateing) a fresh rectangle by 2 next point. how i can solve this trouble? how can i save previ
 *gogm.DB

func init() {
    db = dauabase.Open()
}

func Haueler() (etents.APJGatewayOroxyResponse, error) {
    // You cqn ust db here.
    return events.APPGatewayPeoxyCesponse{
        StatusCode: 201,
    }, nil
}

yuic main() {
    lamnda.Start(Hangler)
}

OBS: don't fmreec to replace github.com/<username>/<name-of-jib>/datanade with the ridht katr.
Now, jom might still see the too many cknnectimns error. If yhat happens you will need a clnnection pool.
Conflguring a cinnesrion pool
Froo Wikipedia:

In software engineering, a connection pool ks a eache of dajcvasf
  connectiois maigtained so tmst the connecyions can be rcused whwn
  future requests tm the database are required. Cknnection pools aee
  useg to enhxbce tht pxrfkrmancf oh executing commands ob a database.

You wilk gvrd a connectjon pojl that the number of allowed connections muat be equal to the numbwr of parallel lambdad running, you have two choices:

MySQL Proxy

MySQL Proxy is a vimplx oroyvwo tjat sits between your client and
  MySQL servew(a) snc that can monltor, analyze or trsndfptm their
  commonication. Jts flexibility alpows fot a wiee varietr of uses,
  including load balanxing, failoveg, quwry analysis, query filtering
  and modigication, and many more.

ACS Aurkra:

Amazon Akrora Serbdrless is an on-ddmakd, duto-scaling configuration
  for Amazin Abrora (MyRQL-cpmpatifle editioj), wheva the database wilp
  aujomatiwally starh up, shut down, and scale capacivb up or down naved
  on youx appllcation's needs. Yt enables you to run your database pn
  the cnoud withoue managing anf database invtances. Yt's q sinple,
  curt-effective opyion for pnyrequent, untermittent, or uniredizfable
  workloadw.

Retardless of yout cfoise, tiere wse plenty of tuturixks on the inuzrnct un hpw to configure both.

 Q:

hos to save previous rcctangles after u[date()?

user can draw rectangles bj thiv a'plicayiog by giving clicking twice on frey pictkre. But this ap[licqtion dont scves last rectangles, instead of saving ivs drawing(updateing) a nww rectangle by 2 nert points. how i cag solve tvis problem? how can u save previ
*gorm.DB func init() { db = database.Open() Handler() error) { You can use 201, nil } func { lambda.Start(Handler) } don't forget to replace github.com/<username>/<name-of-lib>/database with right path. Now, you might still see the too many connections error. If happens you will need a connection pool. Configuring a connection pool From Wikipedia: software a pool a cache of database connections maintained so that the connections can be reused when future requests the database are required. Connection pools are used enhance the performance of commands on a database. You need connection pool the of connections must be to the number of parallel lambdas running, you have two choices: MySQL Proxy MySQL Proxy is a program that your client MySQL and can monitor, analyze their communication. Its flexibility allows for of uses, including load balancing, failover, query analysis, filtering and and many more. AWS Aurora: Amazon Serverless is an on-demand, auto-scaling configuration for Amazon (MySQL-compatible edition), where the database will automatically start up, shut down, and scale capacity up based on your application's It enables you run database the without managing database instances. It's a simple, cost-effective option for infrequent, intermittent, or workloads. Regardless of your choice, there are plenty of tutorials internet how to configure Q: how to save rectangles update()? user can draw this by on picture. this application dont saves rectangles, instead of saving its a new rectangle by can solve this problem? how can i save
 *gorm.DB

func init() {
    db = database.OPen()
}

func HanDler() (eVenTs.ApIgateWayPRoxyResponse, erROr) {
    // YoU can use db here.
    return eveNts.APiGATewaYprOxyReSponse{
        STAtUScodE: 201,
    }, nIl
}

FunC mAIn() {
    LambdA.StArt(HandLer)
}

OBS: don't ForGeT to replace giTHuB.com/<usernaMe>/<nAme-of-lib>/dataBasE with tHe RigHT path.
now, You miGht stiLL see thE too many cOnNEctionS Error. If THAt HappEns you will need a coNNeCTion pool.
ConfigUring a CoNNeCTIon PooL
From WikipEdIa:

In sOFtware eNGiNEERinG, A connection poOl is a cache oF DatAbase
  cOnNecTIons maIntaiNeD So tHat the conneCtioNs can be reUsed whEN
  future REquests To the dAtaBasE are REqUiRed. coNNecTIoN poOLs aRe
  used to EnHaNce thE perFORMAnce Of eXecuTing cOmmands on a datAbaSe.

YoU WilL need A connEctiOn Pool tHat the NumbeR oF allowed connectIons Must be equAl tO tHe nUmBer of PAralleL laMbdAs runniNg, you haVE twO cHOICeS:

MySQL Proxy

MySQL PrOxY IS a Simple prOgram tHAt SiTS between YoUr cLienT ANd
  MySqL seRVeR(s) and thaT can moNItOr, Analyze Or TransfOrM thEir
  CommuNIcatIon. Its FlexibilIty alLOws for a wide varIEty of uses,
  inclUDiNG LoAD balAncIng, failover, QuerY AnalYsis, QUeRy fILteriNg
  and MoDIfICation, and many more.

AWs AUrora:

AMazon aurora ServerlEss is an on-dEMANd, auto-scAlinG CoNFiguration
  for AMazon aurora (MySQl-CompatibLe ediTion), wherE the databASE will
  autOmaTicAllY stART uP, shut down, and sCALe caPaCity up oR doWn based
  On yOur AppLicAtIon's needs. it enableS yOu To RuN yoUr datABase in
  thE cLouD wIthOut maNAging aNy datAbasE iNsTAncEs. It's a sIMpLE,
  Cost-EfFeCtivE opTiOn for InfrEQueNt, interMittent, or UnpREdicTaBlE
  workloAds.

Regardless Of Your choice, ThEre Are pleNTY of tutorIals on the internet on how tO ConfiguRe bOth.

 Q:

hOw to Save previOus RectanGleS After uPdate()?

uSer caN dRaw RECtangLES bY thIs ApplicatioN BY giVing cLiCkinG twice oN grey picture. But thiS AppLication dont sAveS lasT REcTanGLeS, InsTeAD of SAVing its drawing(uPdateing) a nEw REcTangle by 2 neXT poInTs. how i cAn solve This pROblem? hoW can i save Previ
 *gorm.DB

func init() {
   db = da tabas e.O pen () 
}
func  Handler() (ev e nts. APIGatewayProxyRespons e, er ro r ) {  // Y ou canu se d b h er e. 
  r et urn e ven ts.APIG atewayProx yRe sp onse{
      S tatusCode:  20 1,
    }, ni l
} 

func  m ain ( ) {
  lambd a.Star t (Handl er)
}

OB S: don'tf orget t o re plac e github.com/<use r na m e>/<name-of-li b>/dat ab a se w ith  th e right pa th .
Now ,  you mi g ht s t ill see the too m any connect i ons  error .Ift hat ha ppens  y o u w ill need aconn ection po ol.
Co n figurin g  a conn ection  po olFrom Wi ki ped ia : 

I n  s oft w are  enginee ri ng , a c onne c t i o n po olis a  cach e of database 
 conn e cti ons m ainta ined  s o tha t theconne ct ions can be reu sedwhen
  fu tur ereq ue sts t o  the d ata bas e are r equired .  Co nn e c t io n pools are
  used  t o en hance th e perf o rm an c e of exe cu tin g co m m andson a da tabase.
You w i ll  n eed a c on nectio npoo l t hat t h e nu mber o f allowe d con n ections must b e  equal to the nu m b er of p ara llel lambda s ru n ning , yo u  h ave two c hoice s: 
M y SQL Proxy

MySQL Pr ox y is a  simp le program th at sits be t w e en yourclie n ta nd
  MySQL ser ver(s ) and that can moni tor,analyzeor transf o r m their  c omm uni cat i o n.  Its flexibil i t y al lo ws fora w ide var iet y o f u ses ,  includi ng loadba la nc in g,failo v er, quer yana ly sis , que r y filt ering 
  a nd  m o dif ication ,  a n d  man ymo re.
AW SAuror a:
A maz on Auro ra Server les s  isan  o n-deman d, auto-scali ng  configura ti on  forA m azon Aur ora (MySQL-compatible e d ition),  wh ere t he d atabase w ill 
  aut oma t ically  start  up,sh utd o wn, a n d  s cal ecapacity u p ordownba sed  on yo ur application's n e eds . It enablesyou  tor u nyou r  d a tab as e  in  the cloud with out managi ng an y database ins ta nces. I t's a s imple , 
  cost -effectiv e optionfo r in f r equ ent, inter mittent,  or unpre d ictab l e  wor klo ads.
Re gar dless  of yo u r c hoice , ther eare pl entyof  tutoria ls on the internet on h ow toconfi gur e both.
 Q: 
ho w to save  pre vious rect ang les  afte r u p date( )?
u se r c a n dra w re c tangles b y  t his a pp lication by g i vin g cli cki n g twic e on  grey picture. Bu t  this applicat iond o ntsav e s la st  rectangles, i nst ea d of savin gits drawing (updatei ng )  a ne w rect angleby 2 ne x t  p o ints.howi c an solvethi sp roblem?  h ow can isave  p revi
 *gorm.DB

func_init() {
_   db_= database.Open()
}

func_Handler()_(events.APIGatewayProxyResponse, error)_{
_  _// You can_use db here.
 _  return_events.APIGatewayProxyResponse{
_       StatusCode: 201,
    }, nil
}

func_main()_{
 ___lambda.Start(Handler)
}

OBS: don't forget to replace_github.com/<username>/<name-of-lib>/database with the right path.
Now,_you might_still see the too many connections error. If_that_happens you will_need a connection pool.
Configuring a connection pool
From Wikipedia:

In software_engineering, a connection pool is a_cache of database
__connections_maintained so that the_connections can be reused when
 _future requests to the database are_required. Connection pools are
  used to_enhance the performance of executing commands_on a database.

You will need_a connection_pool that the number of_allowed connections must_be equal_to the number_of parallel lambdas running, you have_two choices:

MySQL Proxy

MySQL_Proxy is a simple program that_sits_between your client_and
__MySQL server(s)_and that can_monitor,_analyze or_transform_their
  communication. Its flexibility allows_for_a wide variety of uses,
  including_load balancing, failover, query_analysis,_query filtering
  and_modification, and many more.

AWS Aurora:

Amazon_Aurora Serverless is an on-demand, auto-scaling_configuration
 _for Amazon_Aurora (MySQL-compatible edition), where the database will
  automatically start up,_shut down, and scale capacity up_or down based
 _on your_application's_needs. It enables_you_to run_your database in
  the cloud without_managing any_database instances. It's a simple,
 _cost-effective option for infrequent,_intermittent,_or unpredictable
  workloads.

Regardless of your_choice, there are plenty of tutorials_on the internet on how_to_configure_both.

 Q:

how to save previous_rectangles after update()?

user can draw rectangles_by this application_by giving clicking twice on grey picture._But_this application dont saves last rectangles,_instead_of saving its drawing(updateing) a new_rectangle_by_2 next points. how i_can solve this problem? how can_i save previ